r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[CGI] web server issues

BrianW
28-May-2005
[168]
I mean, I am getting okay results from the command line (no aborted 
message), but still get the same error message when run as cgi.
Volker
28-May-2005
[169]
then i remember that wrong. sad.
BrianW
28-May-2005
[170x2]
[[wisti-:-localhost] cgi-bin]$ /usr/local/bin/rebol -c time.r
content-type: text/html

<HTML> <BODY>
Date/time is: 28-May-2005/16:47:35-7:00
</BODY> </HTML>
[[wisti-:-localhost] cgi-bin]$
I'm a little baffled.
Volker
28-May-2005
[172x2]
make an xterm and unset DISPLAY. that should give the error-message.
or try it from one of the system-consoles, utside x.
BrianW
28-May-2005
[174x2]
[[wisti-:-localhost] cgi-bin]$ unset DISPLAY
[[wisti-:-localhost] cgi-bin]$ /usr/local/bin/rebol -c time.r
content-type: text/html

<HTML> <BODY>
Date/time is: 28-May-2005/16:50:36-7:00
</BODY> </HTML>
no affect. I even tried shifting over to another virtual console 
and ran from there with no bad luck.
Volker
28-May-2005
[176]
^/view should tell something about missing font or such. *shrug*
BrianW
28-May-2005
[177]
I'm using rebcmd2555042a1 for these tests now.
Volker
28-May-2005
[178]
rebcmd has no /view IIRC and should run fine. rebcmdview would be 
interesting. until now i have just given up with linux-cgi and graphics, 
but never tried the betas.
BrianW
28-May-2005
[179]
dang
Allen
28-May-2005
[180]
;Brian. does this run for you?  
print "Content-Type: text/plain^/^/"

print now
probe system/options
BrianW
28-May-2005
[181x2]
nope. I'm starting to think it's a Linux distro issue - I'm running 
Fedora Core 4 beta
.oO(thinking it's time to downgrade)
Allen
28-May-2005
[183]
OK. something else to try. clutching at straws. Sometimes illegal 
chars before rebol header. Try removing the blank line between !path-to-rebol 
& REBOL [] line
BrianW
28-May-2005
[184]
no luck
Allen
28-May-2005
[185]
does http://www.rebol.net/cgi-bin/rbbs.r?cmd=sourcework?
BrianW
28-May-2005
[186]
Not sure if I want to even try, if time.r doesn't work :-D
Allen
28-May-2005
[187]
I've had these issues a couple of times, and never had a satisfactory 
reason/answer why, sometimes just copying script contents pasting 
into a new file with new name, and then it works.
BrianW
28-May-2005
[188]
I'm also having problems with AltMe segfaulting on quit, now that 
I think about it.
Allen
28-May-2005
[189]
lets take this private.. and hopefully post a solution when done.
BrianW
28-May-2005
[190]
... silly question, does the shebang line work within rebol scripts?
Sunanda
29-May-2005
[191]
The shebang is necessary so the webserver can find the right program 
to execute.

(Unless you have set up an appropriate file association between the 
file type and rebol.exe then you may not need it under some operating 
systems and webservers)


The shebang line is treated as a comment by REBOL.exe  -- as is everything 
before the REBOL [...] header
BrianW
29-May-2005
[192]
That's what I thought, but I'm having bizarre issues with the shebang 
and rebol scripts today.
Sunanda
29-May-2005
[193]
I know the feeling.....I've had that at times too.

But all my solutions have already been suggested by Allen or Volker.
Good luck!
BrianW
29-May-2005
[194]
Well, I don't have it working on my home machine, but I've got it 
on coolnamehere.com. So I can work on CGI stuff, and figure out what's 
wrong on my machine at my own leisure :-)
eFishAnt
5-Jun-2005
[195x2]
I think maybe I am the next one going down this path, and somehow 
I stumbled... :-\
I am trying to sort out what the POST data should look like coming 
to a Rebol web server from a browser after someone hits submit.
Sunanda
5-Jun-2005
[197]
It's fairly straigt-foward (I think!).


.......If you have no multi-part data, then just used the "standard" 
read-cgi  -- but remember that on some platforms no input returns 
"" while on others it returns none
http://www.rebol.com/docs/words/wread-io.html


.....If you have multi-part data (say an uploaded file), then use 
Andreas' decode-multipart-form script:

 http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-message.r?m=rmlKVSQ


.....If the form could have both or neither (ie there may or may 
not be a file uploaded), then each of the above solutions will fail 
(Carl's when there is. and Andreas's when there isn't)....So wrap 
the full code in a few attempts to handle that.
eFishAnt
5-Jun-2005
[198]
I would like to be able to look at exactly what the browser submits, 
so I can compare that to what I read in.  There must be some way 
to catch what the browser is sending (or maybe I just have to look 
with ethereal at the packets)
Sunanda
5-Jun-2005
[199]
Stick a proxy in the middle and check the data stream?
eFishAnt
5-Jun-2005
[200]
aha, that is interesting...one more level of program to run simultaneously, 
but I hadn't thought of doing that.
Sunanda
5-Jun-2005
[201]
To see what REBOL receives, just:
   read-io system/ports/input buffer  
Though that may already have been too massaged for your purposes.
MikeL
5-Jun-2005
[202]
Steve, If it is a small number of fields, you can change the html 
submit action from a 'Post to a 'Get then you will see the fields 
in the URL when submitted.   Just take a copy of the HTML page if 
it is not yours and look for the Action word in the Form to change 
then run it yourself.
Volker
5-Jun-2005
[203x4]
(AFAIK:) The browser submits what read-cgi reads. Post means: give 
script all data in stdin (system/ports/input). Thats for lots of 
data, when you post something. Get means, give data in url. Thats 
for getting data, the query is only short (and typable in urlbar). 
So read-cgi write that in a file and read it in an editor.
Andreas script does the same (thanks for link sunanda ;) 

You find there a 'read-post-data, thats read-cgi with another name. 
and that is used in 'decode-multipart-form-data.
A second source of information are the environment-vars passed by 
the server. They are in system/options/cgi.  'decode-multipart-form 
needs system/options/cgi/content-type. There youself can look what 
the datas are too. if it is "multipart/form-data", use 'decode-multipart-form. 
i don't know the other types, just send a script a form and dump 
it.
Steve, now i read your question again, you are writing a complete 
web-server? Why not looking at one available? Patch %webserv.r to 
probe a bit. It also splits the stuff into system/options/cgi, so 
you can study how to do that. Only problem is with post-data, its 
system/ports/input works a bit different to a real webserver. You 
need to look in /content-length and use a copy/part instead of carls 
loop. and sometimes to set the right port-modes by hand IIRC.
eFishAnt
5-Jun-2005
[207x3]
you mean Cal's loop, right, Volker?
I have looked through that some, and I had read the comments in here 
earlier.
I was able to see some packets in ethereal (as a comms guy, I always 
dig through the communications messages to understand what happens, 
so starting to narrow that down.
Chris
1-Jul-2005
[210]
Anyone know a good resource on CHMOD and web folder permissions? 
 Covering eg. what world-executable rights on a folder allows?
Tomc
1-Jul-2005
[211x2]
it allows the directory to be entered/traversed by people who are 
not the owner  of the dir or in the group the directory belongs in
that is a directory may be "readable" but you still need to be able 
to open it to read it
Gabriele
1-Jul-2005
[213x3]
if a dir is readable but not "executable", you can list its contents 
but not access files in it.
if x but not r you can access files in it but not list its contents
if both, you can access files in it and list its contents.
eFishAnt
3-Jul-2005
[216]
any good imagemap examples  in REBOL?
Anton
4-Jul-2005
[217]
for what purpose ?