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

World: r3wp

[CGI] web server issues

Henrik
22-Apr-2005
[85]
well, my index.rhtml file contains script generated output which 
works, encapsulated in :[ ]:. shouldn't I be able to see cgi data?
Volker
22-Apr-2005
[86x5]
i see no cgi-handling in the code.
if content = "rhtml" [
      content: "text/html"
      data: rhtml data
      ]
and that function does nothing
no, i mean, does not call the cgi-stuff.
but its a short function. you could turn it in a real cgi-script, 
with embedded data.
Henrik
22-Apr-2005
[91x2]
trying the same file as index.r now...
it just prints the source
Volker
22-Apr-2005
[93]
yes, it must be a real rebol-script.
Henrik
22-Apr-2005
[94]
the real rebol script just gets outputted in the browser as raw source. 
I read that those scripts must be stored in a cgi-bin directory. 
If I put a testscript test.r with REBOL [] 2+2 in there, webserv.r 
can't find it
Volker
22-Apr-2005
[95x2]
the folder is %www/cgi-bin/ IIRC
first script-line:
print "Content-type: text/html^/"
Henrik
22-Apr-2005
[97]
doesn't work with www/cgi-bin either
Volker
22-Apr-2005
[98x2]
%.cgi as file-extension?
no, docu says .r is ok.
Henrik
22-Apr-2005
[100x4]
cgi gives some strange output
.r doesn't work
the browser prints "HTTP/1.0 200 OK" with .cgi
correction: safari prints the above. Camino (Firefox clone) doesn't 
print anything
Volker
22-Apr-2005
[104x3]
my minimal test-script is
 print "Content-type: text/html^/" 
 probe system/options/cgi
now i have toi move that stuff to windows.
no, text/plain IIRC. i tested the above with a read from rebol.
Henrik
22-Apr-2005
[107x4]
using your testscript, I get no output
interesting... reading test.cgi from rebol console just gives me 
100% cpu power and no output
with trace/net on:

>> read http://192.168.1.27/cgi-bin/test.cgi
URL Parse: none none 192.168.1.27 none cgi-bin/ test.cgi
Net-log: ["Opening" "tcp" "for" "HTTP"]
connecting to: 192.168.1.27
Net-log: {GET /cgi-bin/test.cgi HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL View 1.2.46.3.1
Host: 192.168.1.27
}
Net-log: "HTTP/1.0 200 OK"

and there it sits until I escape it
that's it... I'm moving everything to my mac and see how it goes 
there
Volker
22-Apr-2005
[111]
hmm. confusing. you have rebol[] in the test-script? (lacking ideas 
now)
Henrik
22-Apr-2005
[112x3]
yes
I understand now that rhtml doesn't work for this... but the .cgi 
output looks very strange
can't open a port on the mac... trying my linux box
Volker
22-Apr-2005
[115]
not below 1024. you have to change the "port:" in the script
Henrik
22-Apr-2005
[116x2]
oh thanks... that sort of works
I needed another line in the code before it would output anything
Volker
22-Apr-2005
[118]
ports below needs root-access. hmm, maybe on xp-windows too?
Henrik
22-Apr-2005
[119x2]
and now there is stuff in the cgi object :-)
that could be
Volker
22-Apr-2005
[121]
hey cool :) on mac or windows?
Henrik
22-Apr-2005
[122]
mac of course :-)
Volker
22-Apr-2005
[123]
hehe :)
Henrik
22-Apr-2005
[124x2]
trying higher port number on windows...
now it works there too!
Volker
22-Apr-2005
[126]
aaah!
Henrik
22-Apr-2005
[127]
perhaps it would be an idea to add that to webserv.r docs...
Volker
22-Apr-2005
[128x6]
yes, wuld be good. message Cal.
but strange that the normal pages worked.
for debugging i would look for
   insert tail script-cache reduce [file-path script]

in webserv.r and comment that out. so that it loads allways from 
disk.
and in the error-catch around it 
  [probe disarm local]
instead of 
  []
and for your script:
print "Content-type: text/html^/" 
read-cgi: ...
args: decode-cgi read-cgi 
template: {
 <html><body> <pre> <% mold args %> </pre> </body></html>
}
print build-markup template
thats similar to %.rhtml
have fun ;)
Henrik
22-Apr-2005
[134]
thank you very much!