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

World: r3wp

[CGI] web server issues

Volker
22-Apr-2005
[67]
and a non-alpha rebol? IIRC that has problems with set-modes lines.
Henrik
22-Apr-2005
[68x2]
yes, latest version of webserv.r. I also tried a simple read-io system/ports/input. 
also tried an old rebol/core version and a newer rebol/view version. 
two different machines. three different browsers. same thing.
I must have forgotten something essential...
Volker
22-Apr-2005
[70]
restarted webserv.r after a change? it caches scripts.
Henrik
22-Apr-2005
[71x2]
done that many times now...
also on different rebol instances
Volker
22-Apr-2005
[73]
no good idea. how do you post?
Henrik
22-Apr-2005
[74x2]
first I want GET working, haven't tried post yet, but they should 
be fetched the same way, shouldn't they? if I check system/options/cgi/request-method 
it's none
everything in system/options/cgi is none
Volker
22-Apr-2005
[76]
hu? no, fetching works different. GET is part of the url. POST gets 
more data from the port. system/options/cgi should contain some environment-variables 
AFAIK.
Henrik
22-Apr-2005
[77]
they do. they're all empty
Volker
22-Apr-2005
[78]
normal webserving works?
Henrik
22-Apr-2005
[79x4]
yes, perfectly
ok, here goes: I inserted print [mold system/options/cgi] in the 
beginning of my script
The URL I'm calling is http://192.168.1.27/index.rhtml?mode=FeatureRequests
(local machine)

and it returns:

make object! [
    server-software: none
    server-name: none
    gateway-interface: none
    server-protocol: none
    server-port: none
    request-method: none
    path-info: none
    path-translated: none
    script-name: none
    query-string: none
    remote-host: none
    remote-addr: none
    auth-type: none
    remote-user: none
    remote-ident: none
    Content-Type: none
    content-length: none
    other-headers: []
]
Volker
22-Apr-2005
[83x2]
rhtml is not cgi
that may be it. maybe there is a bug.
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
[116]
oh thanks... that sort of works