Rebol cgi always prints usage information before executing script ??
[1/8] from: Jean:Holzammer:faedv-n:bayern at: 27-Jun-2003 12:45
Hello,
as my web hoster doesn't support rebol officially, I tried to install it
myself.
Uploaded latest rebol/view binary (2.5.5.10) for Linux/X86 to my cgi-bin
directory and set permission to 755.
I also copied rebol.r and my script info.r to the same location.
When I call this script from the web browser, it was actually executed. But
rebol printed its usage information before it !
I tried to reproduce this at my local machine (AmigaOS 3.x/68K, Rebol
2.5.0.x) from the shell. I got the same behaviour, but only when I used an
additional option that is not known, e.g. :
rebol -cswq -dummyoption info.r
But if you compare my script with the usage template as shown in the browser
window, my script does _not_ use any unknown parameters !!!
Any ideas ? Maybe the latest rebol version has different parameters but
still old usage information ?
Regards, Jean
script info.r look like this:
#! rebol -cswq
REBOL []
print "Content-Type: text/html"
print ""
print "<pre>"
probe system/options/cgi
print "</pre>"
output in the browser is:
REBOL <options> <script> <arguments>
All fields are optional. Supported options are:
--cgi (-c) Check for CGI input
--do expr Evaluate expression
--link url Connect to Link
--help (-?) Display this usage information
--nowindow (-w) Do not open a window
--noinstall (-i) Do not install (Link, View)
--quiet (-q) Don't print banners
--reinstall (+i) Force an install (Link, View)
--script file Explicitly specify script
--secure level Set security: allow ask throw quit
--trace (-t) Enable trace mode
--uninstall (-u) Uninstall REBOL (Link, View)
Other command line options:
+q Force not quiet (Link, View)
-s No security
+s Full security
-- args Provide args without a script
Examples:
REBOL script.r
REBOL -s script.r
REBOL script.r 10:30 [test--domain--dom]
REBOL script.r --do "verbose: true"
REBOL -cswq
REBOL --cgi --secure throw --script cgi.r "debug: true"12:38
27.06.03
Content-Type: text/html
<pre>
make object! [
server-software: {Apache/1.3.23 (Unix) (Red-Hat/Linux) mod_ssl/2.8.7
OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26}
server-name: "www.holzammer.net"
gateway-interface: "CGI/1.1"
server-protocol: "HTTP/1.0"
server-port: "80"
request-method: "GET"
path-info: none
path-translated: none
script-name: "/cgi-bin/info.r"
query-string: ""
remote-host: none
remote-addr: "212.34.74.75"
auth-type: none
remote-user: none
remote-ident: none
Content-Type: none
content-length: none
other-headers: ["HTTP_ACCEPT" {application/msword,
application/vnd.ms-excel, application/vnd.ms-powerpoint, image/gif,
image/x-xbitmap, image/jpeg, image/pjpeg, */*} "HTTP_ACCEPT_LANGUAGE" "de"
HTTP_CACHE_CONTROL
"max-age=259200" "HTTP_HOST" "www.holzammer.net"
HTTP_USER_AGENT
"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)"
HTTP_VIA
"1.0 cache1.bybn.de:80 (squid/2.5.STABLE2)"
HTTP_X_FORWARDED_FOR
"unknown"]
]
</pre>
[2/8] from: g:santilli:tiscalinet:it at: 27-Jun-2003 15:56
Hi Jean,
On Friday, June 27, 2003, 12:45:57 PM, you wrote:
HJ> When I call this script from the web browser, it was actually executed. But
HJ> rebol printed its usage information before it !
Usually this is because of line terminators. If you have edited
the script on Windows and then uploaded to a Unix box in binary
mode, the line terminators will remain CRLF, which is not a
problem for REBOL but is for some Unix's shebang line handling.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[3/8] from: gchiu:compkarori at: 28-Jun-2003 8:38
On Fri, 27 Jun 2003 12:45:57 +0200
"Holzammer, Jean" <[Jean--Holzammer--faedv-n--bayern--de]>
wrote:
>Uploaded latest rebol/view binary (2.5.5.10) for
>Linux/X86 to my cgi-bin
>directory and set permission to 755.
Also, one can't usually use /View as Cgi on Linux due to
the need to load up xwindows.
Still waiting for Core/Pro...
--
Graham Chiu
http://www.compkarori.com/vanilla/
[4/8] from: james:temecula-usa at: 27-Jun-2003 21:14
I haven't read all the threads on this but a while back I was aving all
kinds of problems with "working" cgi, i.e., they were working. What it
came down to was I was uploading them via FTP as binaries instead of
ASCII. That was all it took to fix the problem.
James
On Sat, 28 Jun 2003 08:38:01 +1200 "Graham Chiu" wrote:
[5/8] from: carl:s:rebol at: 27-Jun-2003 15:31
I've seen this problem too. I believe that it is caused if a
CR character (13) is present at the end of first line (shell
command) on Unix/Linux systems.
REBOL scripts do not care about CRs, but the command line does.
To fix the problem you can either use ASCII FTP to upload your
script or on the server run REBOL and type:
write %yourscript.r read %yourscript.r
to remove the CR.
It turns out that the latest versions of REBOL were supposed
to detect this situation, so we are investigating why it is
still a problem.
-Carl
[6/8] from: Jean:Holzammer:faedv-n:bayern at: 30-Jun-2003 9:13
Re: Rebol cgi always prints usage information before exec uting script
> From: Gabriele Santilli [SMTP:[g--santilli--tiscalinet--it]]
> Usually this is because of line terminators. If you have edited
> the script on Windows and then uploaded to a Unix box in binary
> mode, the line terminators will remain CRLF, which is not a
> problem for REBOL but is for some Unix's shebang line handling.
Hi,
thanks. That was it. Never had the idea this could be the problem. I saved
the script on an Amiga System, so there should not have been any CRs at all
? After explicitly removing these chars, it works now.
Regards, Jean
[7/8] from: g::santilli::tiscalinet::it at: 30-Jun-2003 12:35
Hi Jean,
On Monday, June 30, 2003, 9:13:57 AM, you wrote:
HJ> thanks. That was it. Never had the idea this could be the problem. I saved
HJ> the script on an Amiga System, so there should not have been any CRs at all
HJ> ? After explicitly removing these chars, it works now.
Hmm, maybe there has been a (wrong) conversion during the
transfer? What editor did you use?
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[8/8] from: Jean:Holzammer:faedv-n:bayern at: 30-Jun-2003 14:31
> Hmm, maybe there has been a (wrong) conversion during the
> transfer? What editor did you use?
I saved the file using GoldEd (v 6) directly to the server (via ftp:
device). File Properties were set to CR/LF. Don't think this is the default.