• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp443
r3wp4402
total:4845

results window for this page: [start: 3901 end: 4000]

world-name: r3wp

Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public]
Terry:
11-Jan-2010
BTW, the typo wasn't in the config file, but in my ws app,  If one 
app doesn't work, should the whole server come down?
Terry:
11-Jan-2010
Might even get away with partial file uploads, incrementals etc.
Dockimbel:
14-Jan-2010
Carl, it's possible to SU to any user while started as root, but 
that will only work for the processes forked, not the first one (the 
Cheyenne/Uniserve main process). In config file, just uncomment those 
lines, choose the adequate user/group targets and restart the server 
:

	;	user  nobody
	;	group nobody


I need to investiguate more in Apache's sources to see how they achieve 
full SU on all processes.
NickA:
17-Jan-2010
Graham,  I've used this code to obtain get/post data in Cheyenne:

REBOL [title: "sitebuilder" file: %sitebuilder.cgi]
print "content-type: text/html^/"
print [<HTML><HEAD><TITLE>"Sitebuilder"</TITLE></HEAD><BODY>]
either system/options/cgi/request-method = "POST" [
    submitted-bin: make string! input
] [
    submitted-bin: system/options/cgi/query-string
]
submitted: decode-cgi submitted-bin

That replaces this Apache CGI code:

#!./rebol276 -cs
REBOL []
print "content-type: text/html^/"
print [<HTML><HEAD><TITLE>"Sitebuilder"</TITLE></HEAD><BODY>]
read-cgi: func [/local data buffer][
    switch system/options/cgi/request-method [
        "POST" [
            data: make string! 1020
            buffer: make string! 16380

            while [positive? read-io system/ports/input buffer 16380][
                append data buffer
                clear buffer
            ]
        ]
        "GET" [data: system/options/cgi/query-string]
    ]
    data
]
submitted: decode-cgi submitted-bin: read-cgi

HTH :)
Terry:
19-Jan-2010
I have a forever loop that checks the processing of the TTS.. once 
it's ready, it pushes it.. That's where the lag comes from. But then 
the .ogg file is cached, and much faster.
Maxim:
20-Jan-2010
this would simplify my life a lot.  I will have 4 servers to keep 
in sync and their setup will be mostly the same but their environments 
will be different.


A lot of the information is spread out in differrent tools and things... 
it would be nice if they could all share (loading) a single file 
when they start and I know I have just one "site" administration 
file to edit to contextualize all the configs of all my rebol-based 
tools.
jrichards:
21-Jan-2010
Thanks Henrik I'll study up more on app-init. It just appears that 
mysql-protocol.r is being loaded by cheyenne on startup because of 
the way database access gets defined in the cfg file.
Dockimbel:
21-Jan-2010
In addition to Henrik's answers, database access can be used in two 
ways, either "manually", opening and closing connection yourself 
from a CGI or RSP script (READ mysql:// prefered in that case), or 
by relying on the RSP webapp API to manage persistent connections 
(see DO-SQL function in RSP API doc).


In both cases, you need to load mysql-protocol.r. The best place 
for that is in the config file in GLOBALS section, just add :

worker-libs [
    %<path-to-mysql-file>/mysql-protocol.r
]


Usually, I define a %libs/ sub-folder in Cheyenne's folder and store 
there all the libraries used by all my RSP or CGI scripts.
Dockimbel:
21-Jan-2010
Max: there's no built-in support for that currently. Correct me if 
I'm wrong, but what you ask for is a preprocessor for the config 
file, no? I guess you could define a unique template config file 
where you could use, for example, issue! values to spot all the parameters. 
Something like: root-dir #root-path-var#.


You could then manage that template from your main location/tool, 
preprocess it and then emit a working file for a given server instance 
when needed.
Maxim:
21-Jan-2010
doc, not really.  Thing is I have different computers with different 
OS / HW / Install environments.

but the systmems they are running are the same but under different 
paths or using different ports, domains, and stuff like that.  


since all of this is done via shell, its very tedious to xfer,  manage 
& edit the data properly for a few apps.  I can easily have a single 
configuration file which just stores values, but let all the apps 
use those values in the same setups.
Terry:
25-Jan-2010
It seems Rebol is causing the problem with the last word getting 
cut off..  I use a read/binary - write/binary of an .ogg file and 
the last bit is cut somehow?
Janko:
28-Jan-2010
my cebelca,biz app is also quite big and "fancy" and uses only 1 
14x14 image file (icon for filters) :) ..
Graham:
1-Feb-2010
This is odd .. I tried calling my batch file using a full path, and 
it did not work.  The only thing that did work was to cd to the directory 
and then call it without the path.
Oldes:
7-Feb-2010
What's the correct way how to deal with uploaded files? I mean... 
if I for example upload a very large file, then I must move it to 
correct location after upload is finished. What is the best way how 
to move a large file in the Cheyenne context? What about a possibility 
to set the custom %incoming/ location before download starts so no 
need for move will be required and we can just rename the file?
Oldes:
7-Feb-2010
I think that under Windows for fast file movement I can use:
set 'MoveFile make routine! [
   		"Moves file using OS"
        lpExistingFileName  [string!]
        lpNewFileName [string!]
   ] kernel32.dll "MoveFileA"
But what about under Linux? Just a simple call?
Gabriele:
7-Feb-2010
RENAME, on same file system. if you don't want to care, call "mv"
Gregg:
7-Feb-2010
And move-file won't be fast all the time. e.g. if you're moving the 
file to another drive.
Will:
7-Feb-2010
here is from the change-log:

RSP: new method 'store added to Request object. It simplifies uploaded 
files

   management by abstracting file's location (memory or disk). Example:

			request/store request/content/file %attached/
			

   will save the uploaded file passed as "file" query parameter in %attached/ 
   folder
	  using the original name (!!watch out for security issues!!).
	  
	  		request/store request/content/file %attached/my-file.bin
	  		

   will save the uploaded file with a forced name (original name needs 
   to be saved
	  separatedly if needed).
Oldes:
8-Feb-2010
I think the in-memory mode is not much needed for me. I was a little 
bit suprised why some files are in memory and other on disk. And 
usualy you would like to store the original file (for example the 
csv) before processing anyway.
Dockimbel:
9-Feb-2010
When uploading a file, the RSP script is called when the upload is 
completed.
jrichards:
12-Feb-2010
In the config file is worker-libs contained within globals or should 
it be preceding globals. Trying to get mysql working.
james_nak:
12-Feb-2010
If you're referring to the httpd.cfg file, I don't have any references 
to mysql except for those referring to actual databases. What I did 
to test mysql was use the rebol mysql driver (in a normal rebol shell) 
outside of the Cheyenne environment to make sure it worked. Hope 
that helps.
Dockimbel:
12-Feb-2010
Jim: 'worker-libs have to be declared inside 'globals section of 
config file.
james_nak:
12-Feb-2010
Doc, I wonder if that is my problem. I don't have worker-libs my 
httpd.cfg file.
Dockimbel:
13-Feb-2010
James: it's not mandatory, you can load mysql driver from 'on-application-start 
event for example (but you'll need to do that for all your webapps). 
It's just simplier to declare it in config file once for all.
Dockimbel:
14-Feb-2010
SVN revision 72: File uploading improvements (changes might break 
older scripts)


FEAT: File upload management improved, in-memory uploading removed 
for consistency.

FEAT: request/store specifications changed. Now it renames the temp 
file to its original name by default. Use the new /as refinement 
to move the file (see Changelog).

FEAT: New complete example of file uploading (client and server-side) 
in www/ folder.

FEAT: New config keyword: 'incoming-dir <%/path/> to specify a custom 
incoming folder per domain or per webapp.
Dockimbel:
23-Feb-2010
Is there any debugging mode to see what Alias thinks I am asking 
it to do?
 


Yes, with at least verbose level 2 (-vv), you get the "Translated 
file:" log line showing you the target file once config file rules 
have been applied.
Janko:
14-Mar-2010
<% 
locale/set-default-lang 'en
print say "test" 
probe locale

print "<hr/>"

locale/set-lang 'fr
print say "test" 
probe locale
%
this generates:

test make object! [ path: %www/cebelca.biz/lang/ lang: 'en current: 
make hash! ["lang" "test" ] default: make hash! ["lang" "test" ] 
......
<hr/>

test make object! [ path: %www/cebelca.biz/lang/ lang: 'en current: 
none default: make hash! ["lang" "test" ] ...
--

after I set lang to fr I have file in fr/fr.cat it says current: 
none (so it didn't load it)

if I reverse the fr and en in code in first case default and current 
are still en and in second they are both en.

It seems like it can't find fr/fr.cat in either of these cases
Janko:
14-Mar-2010
file: join path [mold id slash mold id ".cat"]    ; current dir is 
in the webapp aleready so the path to file doesn't resolve
unless exists? file [return none]
Endo:
14-Apr-2010
is there any other configuration or something to use databases with 
cheyenne? I configured as it shown in web site but I always get the 
error:

##RSP Script Error: 
	URL  = /
	File = www/index.rsp
	** Access Error : Invalid port spec: odbc://test2
	** Where: do-sql 
	** Near:  [do-sql 'test2 "select * from table" 
__txt 62
] 

my rsp site is:
<%
	print do-sql 'test1 "select top 10 * from sec_log1"
%>

and the httpd.conf file:

databases [
	test1	mysql://[root-:-localhost]/test
	test2	odbc://test
]
Oldes:
15-Apr-2010
Does anybody use user and group directive in httpd.cfg? When I uncoment 
it and use own user name, than I got error:
## Error in [conf-parser] : Error in conf file at:
user oldes
group oldes
Janko:
19-Apr-2010
I think if I could make user.r execute on start this problem would 
be solved. I wasn't able to make it autoexecute on linux yesterday 
.. I already spent 6  hours before with this stuff without accomplishing 
anything so I stopped at that point. I will try with user.r again 
now. user.r didn't start on rebol/core or rebpro on linux for me 
yesterday ( I had rebol.r and user.r in same file as script, in same 
file as executables, I tried to set REBOL_HOME and REBOLHOME)
Janko:
25-Apr-2010
with init.d you have multiple files for different stages of startup 
and shutdown process so it's a little complicated.. the guy (he was 
on ubuntu showed me just one file where you add cli commands and 
that's it)
BudzinskiC:
25-Apr-2010
Graham, which version of Ubuntu are you using? The newest version 
of Ubuntu doesn't use the /etc/init.d system anymore, it uses upstart 
instead: http://upstart.ubuntu.com/getting-started.html.Much easier 
but less powerful (but maybe enough for you) is editing the /etc/rc.local 
file. That just starts an app after booting, it doesn't allow you 
to restart or stop it with a command. Just put the command to start 
up cheyenne on a line between "# By default this script does nothing." 
and "exit 0"
Graham:
25-Apr-2010
I have to run cheyenne.r to allow it to create a cache.efs file and 
then I can run the binary
Graham:
26-Apr-2010
Is there a simple file upload script demo .... ?
Graham:
26-Apr-2010
this is for a non existent file
Graham:
26-Apr-2010
Doc, any explanation as to why it can be so hard to start Cheyenne? 
 I think it is to do with the .cache.efs file
Terry:
7-May-2010
wrote the data of that example to a text file.. 117mb
Oldes:
9-May-2010
I use something like this in my nginx config:
        location ~ \.(rsp|cgi)$ {
            proxy_pass   http://lucya.desajn.web:8080;
            
            proxy_set_header   X-Real-IP        $remote_addr;

            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_set_header   X-URI $request_uri;

            proxy_set_header   if-modified-since $http_if_modified_since;
            
			client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;

            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;
        }
Robert:
9-May-2010
I get an "confirm" error from a RSP page that tries to delete a local 
file. How can I do this?
Dockimbel:
9-May-2010
What do you get when trying to delete this file from console launched 
with the same uid/gid than Cheyenne?
Kaj:
10-May-2010
--- mod-userdir.r.original	2010-05-09 19:28:10.000000000 +0200
+++ mod-userdir.r	2010-05-11 00:45:24.000000000 +0200
@@ -12,40 +12,81 @@
 	on-started: does [do boot-code]
 	on-reload:  does [clear boot-code]
 	
-	get-ugid: func [name [string!] /local file uid gid][
-		if none? attempt [file: read %/etc/passwd][
+	get-ugid: func [name [string!] /local file line uid gid][
+		unless attempt [file: read/lines %/etc/passwd][
 			log/error "accessing /etc/passwd failed"
 			return none
 		]
-		unless parse/all file [
-			thru name 2 [thru col]
-			copy uid to col skip
-			copy gid to col
-			to end
-		][
-			log/error "reading /etc/passwd failed"
+		foreach line file [
+			if all [line: find/case/match line name  col = first line][
+				return either parse/all next line [
+					thru col
+					copy uid to col skip
+					copy gid to col
+					to end
+				][
+					reduce [to-integer uid to-integer gid]
+				][
+					log/error "invalid format reading /etc/passwd !"
+					none
+				]
+			]
+		]
+		log/error "user not found in /etc/passwd"
+		none
+	]
+	
+	get-gid: func [name [string!] /local file line gid][
+		unless attempt [file: read/lines %/etc/group][
+			log/error "accessing /etc/group failed"
 			return none
 		]
-		reduce [to-integer uid to-integer gid]
+		foreach line file [
+			if all [line: find/case/match line name  col = first line][
+				return either parse/all next line [
+					thru col
+					copy gid to col
+					to end
+				][
+					to-integer gid
+				][
+					log/error "invalid format reading /etc/group !"
+					none
+				]
+			]
+		]
+		log/error "group not found in /etc/group"
+		none
 	]
 	
-	change-id: func [id [word! integer!] /user /group][
-		if word? id [
-			if none? id: get-ugid mold id [return none]
-			id: pick id to-logic user

+	change-id: func [id [string! integer!] /user /group /local gid][
+		either string? id [
+			unless id: get-ugid id [return none]
+			set [id gid] id
+		][
+			gid: id
 		]
-		either user [
+		if group [setgid gid]
+		if user [
 			;logger/file.log: join logger/file ["-" id %.log]
 			setuid id
-		][setgid id]
+		]
+	]
+	
+	change-gid: func [id [string! integer!]][
+		if string? id [
+			unless id: get-gid id [return none]
+		]
+		setgid id
 	]
 	
 	words: [
 		user: [word! | integer!] in globals do [
-			repend boot-code ['change-id/user to-lit-word args/1]

+			repend boot-code either word? args/1 [['change-id/user/group 
mold args/1]] [['change-id/user args/1]]
 		]
 		group: [word! | integer!] in globals do [
-			repend boot-code ['change-id/group to-lit-word args/1]
+			unless empty? boot-code [change boot-code [change-id/user]]

+			insert boot-code reduce ['change-gid either word? args/1 [mold 
args/1][args/1]]
 		]
 	]
 ]
\ No newline at end of file
Kaj:
10-May-2010
IDs that you specified were looked up in the user file - also if 
you specified the group. Although in most cases on most systems, 
user names have a matching group name with the same number, this 
is clearly wrong
Kaj:
10-May-2010
I'm not sure how meaningful it is to also specify a separate group 
(different from the group of the user), but if you do it should be 
looked up in the group file instead of the users file, so now it 
does that
Kaj:
10-May-2010
The users and groups files are line oriented, but they were searched 
as a whole with PARSE. This can easily go wrong, for example if the 
name appears elsewhere in the file, for example in the comment field. 
They're now searched line by line
Kaj:
10-May-2010
The format for the configuration file allows numbers for the specified 
user and group IDs, and this is indeed useful, but they weren't supported 
in the processing functions. They are now
Kaj:
11-May-2010
I think there's only one issue left, for which I don't see an easy 
solution. If you specify both a user and a separate group, it must 
be in that order in the configuration file, because the group definition 
modifies the boot code that the user definition generates. Reversing 
them gives you the group belonging to the user, instead of the separate 
group
Janko:
7-Jun-2010
can I somehow automatically execute run one file or a pack of code 
before each page load If I am not in webapp? I added do %... to each 
html file now but it's not very elegant.
Graham:
8-Jun-2010
I start it up with sudo under linux and the very first time it works.
I reboot, and then try again, and it just quits ... everytime.

I then use rebol/core and when I do %cheyenne.r it complains it can't 
write the cache efs file.  

I allow it, and then restart the cheyenne binary and then it runs 
okay.
Graham:
8-Jun-2010
So my question is, does the cheyenne binary need to write the cache 
efs file each time?

What do I need to do to allow Cheyenne to start reliably each time 
...?
Graham:
8-Jun-2010
going to copy the .cache.efs file to cache.efs and then copy it back 
each time with a shell script to see if that fixes it
Kaj:
8-Jun-2010
That's odd; with regular Unix file permissions, the only way you 
could not have access as super user is if the file is read-only, 
but cache and log files would be unlikely to be that
Graham:
8-Jun-2010
I can write the .cache.efs file as sudo in rebol, but no sudo in 
cheyenne.  Bizarre huh?
Kaj:
8-Jun-2010
Any harsh protection subsystems running on that Ubuntu besides the 
traditional Unix file security?
Graham:
8-Jun-2010
Nope. This is a new ubuntu default installation.  I am *presuming* 
cheyenne quits because it can't write the .cache.efs file  but don't 
know for sure
Graham:
8-Jun-2010
Well, I don't know what is going on but hopefully my saving a copy 
of the .cache.efs file and copying it anew each time the user restarts 
cheyenne will bypass this issue
Terry:
12-Jul-2010
fyi html5 has a new file api.. 
http://dailyjs.com/2009/11/30/html5-file-api/
Terry:
12-Jul-2010
Since the File API is asynchronous, files could be loaded and processed 
in the background while the user does other things. This could also 
be useful for creating web applications that work offline.
Terry:
12-Jul-2010
File Api Demo (requires firefox)
http://html5demos.com/file-api
Oldes:
30-Jul-2010
Then I use code like:
with ctx-imagick [
			default/filter: 5
			default/blur: .95
			start
			try MagickReadImage *wand to-local-file src_file
			*wand2: CloneMagickWand *wand
			if h > 800 [

    try MagickResizeImage *wand to-integer (w * (600 / h)) 600 default/filter 
    default/blur
				try MagickSetImageCompressionQuality *wand 70
				trg_file: to-local-file rejoin [dir id #"_" sfil %_x600. ext]
				try MagickWriteImages *wand trg_file
				
				ClearMagickWand   *wand
				DestroyMagickWand *wand
				*wand: *wand2
				*wand2: CloneMagickWand *wand
			]
			
			nw: to-integer (w * (400 / h))
			either nw > 780 [

    try MagickResizeImage *wand 780 (h * 780 / w) default/filter default/blur
			][

    try MagickResizeImage *wand nw 400 default/filter default/blur
			]

			try MagickSetImageCompressionQuality *wand 70
			trg_file: to-local-file rejoin [dir id #"_" sfil %_x400. ext]
			try MagickWriteImages *wand  trg_file
			ClearMagickWand   *wand
			DestroyMagickWand *wand
			*wand: *wand2
			*wand2: CloneMagickWand *wand
			

   try MagickResizeImage *wand to-integer (w * (200 / h)) 200 default/filter 
   default/blur
			try MagickSetImageCompressionQuality *wand 70
			trg_file: to-local-file rejoin [dir id #"_" sfil %_x200. ext]
			try MagickWriteImages *wand trg_file 
			ClearMagickWand   *wand
			DestroyMagickWand *wand
			*wand: *wand2
			*wand2: CloneMagickWand *wand
			

   try MagickResizeImage *wand to-integer (w * (60 / h)) 60 default/filter 
   default/blur
			try MagickSetImageCompressionQuality *wand 70
			trg_file: to-local-file rejoin [dir id #"_" sfil %_x60. ext]
			try MagickWriteImages *wand trg_file
			ClearMagickWand   *wand
			DestroyMagickWand *wand
			*wand: *wand2

			end
		]
Oldes:
30-Jul-2010
to get image sizes I use:
with ctx-imagick [
		w: h: none
		attempt [
			start
			try MagickPingImage *wand to-local-file file/2
			w:   MagickGetImageWidth  *wand
			h:   MagickGetImageHeight *wand
			ext: MagickGetImageFormat *wand
			end
		]	
	]
Maxim:
2-Aug-2010
there is an example of a virtual domain setup in the config file 
provided in cheyenne.
Kaj:
10-Aug-2010
Wasn't Doc planning a virtual file system for that?
Graham:
22-Aug-2010
This is a little odd .... I created a PDF and sent it back to the 
browser using the response, and application pdf, and the browser's 
security prevents it from downloading ....on some of the user's PC's 
( at a hospital ), but if I write the pdf to the disk and then redirect 
the browser to the file in the www directory, there's no complaint!
florin:
24-Aug-2010
Is the app-init.r file the place to map a template file (.html) to 
a mirror .r file? If so, we could use the response/buffer to have 
access to the dom. I tried to use the app-init.r file yet it did 
not work for me.
Graham:
24-Aug-2010
I pretty much gave up on using the app-init.r file ... it is supposed 
to be local to the app, but I found variables spilling to other apps
florin:
24-Aug-2010
What need for clean templeting is access to the html source file. 
I'd use the element ID to match with a backing .r file variable / 
component model. No scripting, no tags in the html file. So the question 
is, how can cheyenne let me map these two files?
florin:
24-Aug-2010
/path-to-file/page.html mapping to /same-path/page.r. From here, 
page.r works on the response/buffer.
florin:
24-Aug-2010
allows a mapped file to access the response/buffer before it returns 
it.
florin:
24-Aug-2010
Aha. No. I guess that's where it is. I used .htm. Yet I found that 
the script in the .htm file also is processed. So there is a difference.
florin:
25-Aug-2010
The JS is executed by the browser once the buffer is returned to 
the browser. What I want is a mapped .r file to process the DOM source 
on the server side. I don't see where the JS concern.
florin:
25-Aug-2010
Graham: so say your library updates . .you have to update all the 
pages that use the js libraries" . The answer is yes. The html file 
would generally behave as any other html file that is not backed 
up by any server side.
florin:
25-Aug-2010
There could be a application.r file that allows for global / conditional 
page includes. What I care most is that the html file remains as 
a designer wants it - no scripting.
florin:
25-Aug-2010
Don't you love it when it happens! I was working on the http.cfg 
file located in the cheyenne source rather then the proper one. I 
should've listened ot my wife an go to bed!
florin:
25-Aug-2010
The re-usability that you are looking for (i.e. the JS, etc) could 
be met with a simple configuration file and page fragements.
florin:
29-Aug-2010
Gabriele: in the temple.r file, the word CONTEXT is used to define 
some functions, then you export them with the 'export function defined 
in the utility.r file. Is there a 'best practice' about it as I don't 
see the difference compared to simply defining it within the scope 
of the file?
Kaj:
7-Sep-2010
--- mod-userdir.r.original	2010-05-09 19:28:10.000000000 +0200
+++ mod-userdir.r	2010-05-11 00:45:24.000000000 +0200
@@ -12,40 +12,81 @@
 	on-started: does [do boot-code]
 	on-reload:  does [clear boot-code]
 	
-	get-ugid: func [name [string!] /local file uid gid][
-		if none? attempt [file: read %/etc/passwd][
+	get-ugid: func [name [string!] /local file line uid gid][
+		unless attempt [file: read/lines %/etc/passwd][
 			log/error "accessing /etc/passwd failed"
 			return none
 		]
-		unless parse/all file [
-			thru name 2 [thru col]
-			copy uid to col skip
-			copy gid to col
-			to end
-		][
-			log/error "reading /etc/passwd failed"
+		foreach line file [
+			if all [line: find/case/match line name  col = first line][
+				return either parse/all next line [
+					thru col
+					copy uid to col skip
+					copy gid to col
+					to end
+				][
+					reduce [to-integer uid to-integer gid]
+				][
+					log/error "invalid format reading /etc/passwd !"
+					none
+				]
+			]
+		]
+		log/error "user not found in /etc/passwd"
+		none
+	]
+	
+	get-gid: func [name [string!] /local file line gid][
+		unless attempt [file: read/lines %/etc/group][
+			log/error "accessing /etc/group failed"
 			return none
 		]
-		reduce [to-integer uid to-integer gid]
+		foreach line file [
+			if all [line: find/case/match line name  col = first line][
+				return either parse/all next line [
+					thru col
+					copy gid to col
+					to end
+				][
+					to-integer gid
+				][
+					log/error "invalid format reading /etc/group !"
+					none
+				]
+			]
+		]
+		log/error "group not found in /etc/group"
+		none
 	]
 	
-	change-id: func [id [word! integer!] /user /group][
-		if word? id [
-			if none? id: get-ugid mold id [return none]
-			id: pick id to-logic user

+	change-id: func [id [string! integer!] /user /group /local gid][
+		either string? id [
+			unless id: get-ugid id [return none]
+			set [id gid] id
+		][
+			gid: id
 		]
-		either user [
+		if group [setgid gid]
+		if user [
 			;logger/file.log: join logger/file ["-" id %.log]
 			setuid id
-		][setgid id]
+		]
+	]
+	
+	change-gid: func [id [string! integer!]][
+		if string? id [
+			unless id: get-gid id [return none]
+		]
+		setgid id
 	]
 	
 	words: [
 		user: [word! | integer!] in globals do [
-			repend boot-code ['change-id/user to-lit-word args/1]

+			repend boot-code either word? args/1 [['change-id/user/group 
mold args/1]] [['change-id/user args/1]]
 		]
 		group: [word! | integer!] in globals do [
-			repend boot-code ['change-id/group to-lit-word args/1]
+			unless empty? boot-code [change boot-code [change-id/user]]

+			insert boot-code reduce ['change-gid either word? args/1 [mold 
args/1][args/1]]
 		]
 	]
 ]
\ No newline at end of file
Dockimbel:
7-Sep-2010
There's also the Cheyenne PID file written in /tmp/cheyenne.pid that 
will suffer the same issue.
Dockimbel:
8-Sep-2010
re System logging service: it's not an option because :
- not a cross-platform solution

- some files *have* to be generated directly by Cheyenne (like the 
HTTP log file)

- the trace output in debug mode can generate huge entries that are 
inappropriate for syslog

- the trace output needs to be free from non-Cheyenne entries (or 
it might become unpractical to use for developers)
Dockimbel:
8-Sep-2010
I'm changing PID file path to /var/run/
Dockimbel:
9-Sep-2010
Still, I can't make Cheyenne work as non-root user : the HTTP log 
file keeps being written as root:root even if the main Cheyenne process 
is own by a non-root user. The culprit seems to be the REBOL helper 
process, forked by the main one during REBOL internal boot process 
(so before starting to run user code). I found no way to setuid this 
child process (seems forbidden by the OS?), so it keeps being owned 
by root...


Here's my typical test case under linux (Ubuntu 8.04, /enpro 2.7.6, 
latest SVN revision,using [user "dk"] in config file). I'm running 
the test from a root shell to avoid issues of sudo with REBOL binaries 
(RAMBO #4306) :

;--- launching  Cheyenne process  ---
[root-:-dknux]:/mnt/dev/Cheyenne# ./cheyenne &
[1] 20179


;--- notice the root process below (the only one that Cheyenne can't 
setuid( ) ---
[root-:-dknux]:~# ps aux
[...]

dk       20179  0.2  1.3   9028  6716 pts/0    S    22:21   0:00 
./cheyenne

root     20180  0.0  0.1   2360   600 pts/0    S    22:21   0:00 
./cheyenne

dk       20182  0.1  0.9   6264  4964 pts/0    S    22:21   0:00 
./cheyenne -l -worker 9799

dk       20183  0.0  0.0   2184   236 pts/0    S    22:21   0:00 
./cheyenne -l -worker 9799

dk       20184  0.1  0.9   6264  4964 pts/0    S    22:21   0:00 
./cheyenne -l -worker 9799

dk       20185  0.0  0.0   2184   232 pts/0    S    22:21   0:00 
./cheyenne -l -worker 9799

dk       20186  0.1  0.9   6264  4968 pts/0    S    22:21   0:00 
./cheyenne -l -worker 9799

dk       20187  0.0  0.0   2184   236 pts/0    S    22:21   0:00 
./cheyenne -l -worker 9799

dk       20188  0.1  0.9   6264  4964 pts/0    S    22:21   0:00 
./cheyenne -l -worker 9799

dk       20189  0.0  0.0   2184   232 pts/0    S    22:21   0:00 
./cheyenne -l -worker 9799

;--- no HTTP log file for now ---
[root-:-dknux]:/mnt/dev/Cheyenne# ls -l log/
total 0

;--- I'm sending a request to http://localhost/---
[root-:-dknux]:/mnt/dev/Cheyenne# ls -l log/
total 1
-rw-r--r-- 1 root root 77 2010-09-09 18:19 default-access.log


The log file belongs to root:root, so it must have been generated 
by process 20180. Killing that process prevents Cheyenne from outputing 
any new log file (but Cheyenne keeps serving all requests). I thought 
that the helper process was only used for enabling async dns requests 
when OS doesn't support it natively?...<vent>Like REBOL GC's rules, 
this helper process remains a mystery even after 10 years of reboling...I 
guess these secrets are worth millions of $ to be kept undisclosed 
so far...</vent>

Any ideas?
Kaj:
9-Sep-2010
Neither explains file handling
Graham:
15-Sep-2010
What causes this error?


15/9-02:54:33.067-## Error in [task-handler-4721] : Make object! 
[
    code: 303
    type: 'script
    id: 'expect-arg
    arg1: 'protected-exec
    arg2: 'code
    arg3: [block! function!]

    near: [protected-exec/event request/parsed/file get in session/events]
    where: 'fire-event
] !
Dockimbel:
15-Sep-2010
I've removed %app-init.r from %www/testapp in Cheyenne's archive, 
started a fresh Cheyenne session, logged in http://localhost/testapp
and I can't reproduce your error. I only keep receiving this kind 
of (normal) error: 

##RSP Script Error: 

	URL  = /testapp/login.rsp
	File = app-init.r


 ** Access Error : Cannot open /C/Dev/Cheyenne/www/testapp/app-init.r 
	** Where: rsp-script 
	** Near:  [init: load join root %/app-init.r]
Dockimbel:
28-Sep-2010
Oldes: we have one here somewhere, but I can't find it right now. 
Anyway: 
 

1) "kill -9" is not a good way to stop Cheyenne, a simple "kill" 
is the right way (this signal is caught by Cheyenne to clean up things 
and exit properly).


2) "ps aux | awk ..." is not required, Cheyenne stores its main PID 
in /var/run/cheyenne.pid (or /tmp/cheyenne.pid in revisions < r90). 
Just read this PID and send all signals to that process only. Watch 
out if you run it on port <> 80, you'll find the port-id inserted 
in the PID file name.
Oldes:
28-Sep-2010
The problem with the PID file is, that I was not able to read it 
because of permisions. But I may check it again.
Dockimbel:
28-Sep-2010
The PID file should have the same rights as the Cheyenne process, 
let me see if this works as it should.
Dockimbel:
28-Sep-2010
The PID file is still own by root in that case. It's readable by 
other users but not writable (Cheyenne can't delete it on exiting). 
I need to fix that.
Dockimbel:
28-Sep-2010
It seems that the PID file location recent change was a bad move, 
/var/run is by default only writable by root...To workaround that, 
user should create a sub-folder as root and then chown it to the 
application user to allow it to write PID files there : http://serverfault.com/questions/159334/what-permission-to-write-pid-file-in-var-run
Oldes:
28-Sep-2010
So here is my new init.d file:
#! /bin/sh
# /etc/init.d/cheyenne
#

# Some things that run always
#touch /var/lock/blah

STARTSCRIPT=/web/start-ch.sh
PID=$(tail /tmp/cheyenne-8000.pid)

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting Cheyenne "
    $STARTSCRIPT
    RETVAL=$?
    ;;
  stop)
    echo "Stopping Cheyenne"
    kill $PID
    RETVAL=$?
    ;;
  reload)
    echo "Reloading Cheyenne"
    kill -HUP $PID
    RETVAL=$?
    ;;
  reset)
    echo "Reseting Cheyenne"
    kill -USR1 $PID
    RETVAL=$?
    ;;
  restart)
    echo "Stopping Cheyenne"
    kill $PID
    echo "Starting Cheyenne"
    $STARTSCRIPT
    RETVAL=$?
    ;;
  *)

    echo "Usage: /etc/init.d/cheyenne {start|stop|reload|reset|restart}"
    exit 1
    ;;
esac

exit 0


(maybe it should be put on the wiki or into the repository to help 
other linux newbies)
Oldes:
28-Sep-2010
btw.. the /web/start-ch.sh looks like:
#!/bin/bash
cd /web/
./cheyenne &

I must use it because running cheyenne using full path like:
/web/cheyenne &

does not work as expected - it looks it does not gets the httpd.cfg 
file (probably)
Dockimbel:
7-Oct-2010
MaxV: thanks for the offer, but it's not required for now  as there's 
only one file to distribute (when encapped).
Dockimbel:
7-Oct-2010
SVN revision 93:

o FEAT: new config keyword 'pid-dir for setting user-defined folder 
for Cheyenne's PID file.

o FEAT: Cheyenne's SVN global revision number now appended to Server 
response header.

o FIX: default location for %cheyenne.pid is reverted back to /tmp.

o FIX: PID file now takes the correct process uid:gid when Cheyenne 
is not run as root.
Dockimbel:
11-Oct-2010
SVN r95

FIX: boot log improved, now every warning/error during boot will 
be logged in file even when verbose mode is not set

FIX: (UNIX) chey-pid-*.log files are now CHOWN-ed to target user 
when required (fixes verbose mode issue)

FIX: (UNIX) when user ID was not found in system file, it was accidently 
set to root ID resulting in no error reporting
Dockimbel:
27-Oct-2010
SVN r96 -> r103 (most of new features were suggested by Carl)  


FEAT: encapped Cheyenne binaries now returns 0 (or, in case of panic, 
a REBOL error code) on exit

FEAT: (UNIX) Added a new command line option: -V or --version. Displays 
Cheyenne's version, then quits.

FEAT: (Windows) Cheyenne's version is now displayed in the tray icon 
help message.

FEAT: RSP debug mode extended to display tail of trace.log file using 
a new [show trace] button.

FEAT: RSP debug bar look improved, menu horizontal alignment fixed, 
direct link to RSP API online
documentation added.

FEAT: RSP errors are now displayed in an overlay popup instead of 
being inlined in the page.

FEAT: RSP debug bar javascript code footprint reduced to a single 
object: rspdbg (avoids polluting global namespace)

FEAT: new RSP API function: debug. Switches the debug mode on or 
off, for the current RSP script.

FEAT: new API function: debug?. Returns TRUE if debug mode is active.

FEAT: 'debug config keyword definition extended to accept an optional 
block of parameters.

FEAT: RSP session/start now returns the session/active? flag as result.

FEAT: (UNIX) Added a new boot option: -h or --help. Displays the 
command line syntax help and quits.

FEAT: Improved RSP function 'validate to accept default values for 
optional parameters when using
the /full refinement.

FEAT: now plain REBOL scripts can also be run by the RSP engine! 
(see www/show.r)

FEAT: new RSP API function: emit. Does a REDUCE on its argument before 
APPENDing to response/buffer.

FEAT: added new RSP syntax for emit-action : <%? ... %>. Does the 
same as 'emit, but inlined in a
template page.

FIX: (Windows) improved child processes termination with a more graceful 
method using JobObject API

FIX: (UNIX) optimized child processes termination using a kill() 
routine! wrapper instead of CALLing the shell command
FIX: flush HTTP logs in cache on exiting.

FIX: mod-userdir was still commented in config file modules list, 
disabling user/group keywords in httpd.cfg

More info on the new RSP functions in changelog.txt file.
PeterWood:
2-Nov-2010
I would prefer to force Cheyenne to execute the script as a real 
CGI Script as I am trying to run REBOL/Services as a CGI script under 
Cheyenne. Ideally, I don't want to have to change the REBOL/Services 
code. (I am migrating a REBOL/Services application away from its 
existing web server and hopefully to Cheyenne. In the longer term, 
it may be possible to convert it to a Cheyenne web app).


Any hints on how to force Cheyenne to run a .cgi file as a real CGI 
script?
Oldes:
5-Nov-2010
But I've found a bug in the current version:
5/11-10:57:51.468-## Error in [mod-static] : Make object! [
    code: 500
    type: 'access
    id: 'cannot-open

    arg1: {/F/SVN/cheyenne-server/Cheyenne/log/h-arch.desajn.web:8080-access.log}
    arg2: none
    arg3: none

    near: [write/append join log-dir [req/vhost #"-" log-file] second]
    where: 'do-handler
] !
The #":" is not a valid char for a file name.
Dockimbel:
17-Nov-2010
SVN revision 110:

FEAT: default REBOL CGI scripts are now run as normal CGI.

FEAT: new config keyword: fast-rebol-cgi. Forces running REBOL CGI 
scripts in FastCGI mode.

FIX: (Windows) CGI handler rewritten to fix environment variables 
passing.

FIX: CGI 'set-env mapping code refactored, setup errors are now properly 
logged.
FIX: CGI scripts errors are now logged in %trace.log file.

Windows binaries are available for testing:
http://cheyenne-server.org/tmp/cheyenne-r110-pro.zip
http://cheyenne-server.org/tmp/cheyenne-r110-cmd.zip
Kaj:
1-Dec-2010
My Firefox 3.5 wants to save the file. Isn't that a normal reaction 
for a bare json file?
3901 / 484512345...3839[40] 4142...4546474849