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

World: r3wp

[CGI] web server issues

Volker
25-Oct-2005
[298]
5 is read execute, that should be ok. script-headers is the "Content-type: 
text/html^/^/". When you have output on rebol-side before (like error-message), 
this is the servers way to handle that. my usual way is to put "Content-type: 
text/plain^/^/" as first statement and get readable output that way. 
 Does not help if the script is not running at all of course. btw, 
the rebol-exe has the right args too? Easy to forget.
james_nak
25-Oct-2005
[299]
Yes, I actually moved over a script I know worked (from the rebol 
viewpoint).
Volker
25-Oct-2005
[300]
Means rebol runs there, your script not?
james_nak
25-Oct-2005
[301x3]
Wow, don't know why but it works now. Thanks Volker.
I'll backtrack to see what had happened. Me thinks it has to do with 
the my script "do"ing a library script. Maybe something was wrong 
with that.
Of course it always worked on the other hosts.
Volker
25-Oct-2005
[304]
most time path-issues then. some folderpath changed i guess.
james_nak
25-Oct-2005
[305x2]
Btw, I just got one of those virtual dedicated servers and so there 
are a lot of little things I have to do which I didn't owrry about 
before.
owrry = worry
Volker
25-Oct-2005
[307]
but if the script runs, you can track the error-message. either by 
that header, or also helpfull: echo %/make-sure-you-can-write-here/echo.txt 
. that captures the last output, and you can use ftp to look at it.
james_nak
25-Oct-2005
[308x2]
Good idea. I just went back and recreated a 2nd test and it worked 
fine as well. Hmmmm.
I bet the chmod didn't take.
Volker
25-Oct-2005
[310]
thats another trap :) i always ls the rights after a change now..
james_nak
25-Oct-2005
[311]
Yep. Isn't it crazy how many changes we make when it's something 
rather easy after all?
Volker
25-Oct-2005
[312x2]
Setting up configurations? yes, thats true.
After all Carl decided to do rebol when he set up a linux-server..
james_nak
25-Oct-2005
[314]
Well, then I'm glad it's difficult. With me it's about everything. 
Back to testing. Thanks alot.
Sunanda
25-Oct-2005
[315]
< "Premature end of script headers">

 Usual cause: wrong line terminations....Maybe you uploaded a test 
 file from/to UNIX/MAC/Win without checking the "asciii" box to get 
 automatic CRLF/CR/LF conversions.
james_nak
26-Oct-2005
[316]
Sunanda, thanks. I have in fact done that before. I think what was 
really happening was that the files were not chmoded correctly. All 
is well now including mysql through Rebol (which I thought was going 
be very difficult to fix). Again thanks.
RebolJohn
15-Nov-2005
[317]
Hello everyone..
I have a CGI problem/question.


I have a Win-apache-rebol server that isn't propagting the cgi info 
properly..
Upon posting.. the query-string is empty.
I am not sure what I am missing..

Details:

page1.rcgi
========================
#!c:\rebol\rebol.exe -cs
rebol []
print "content-type: text/html^/"
print "<html><body>"
print "  <form action='page2.rcgi' method='POST'>"

print "    <input type='text' name='var01' size='16' value='test'>"
print "    <input type='submit' name='go' value='Lookup'>"
print "  </form>"
print "</body></html>"


page2.rcgi
========================
#!c:\rebol\rebol.exe -cs
REBOL [ ]
print "content-type: text/html^/"
print "<html><body>"
print mold system/options/cgi
print "<hr>"
print "</body></html>"



if I .. ( decode-cgi system/options/cgi/query-string ), my vars are 
all undefined.

Also, looking at the 'print mold system/options/cgi' shows   query-string=""

if I change page1 form-action to ... "action='page2.rcgi?x=123"

then the query-string on page2 gets populated with x=123 and the 
value 123 gets assigned to 'x'
when I 'decode-cgi'.

However, my form fields NEVER get populated.
Does anyone have any advice?

John.
Sunanda
15-Nov-2005
[318]
You are using "post" -- that needs some extra processing compared 
to get.

See: http://www.rebol.com/docs/cgi2.html-- loook for read-cgi function
RebolJohn
15-Nov-2005
[319]
Duh.. Thanks alot. I changed it to GET and all works fine.    I have 
been scrappin' over this for 3 days now.  Thanks again.
Sunanda
15-Nov-2005
[320]
Glad to help......Get is probably better unless the form data exceeds 
1k or so.
BrianH
15-Nov-2005
[321]
I prefer to use get for variables that are part of a logical location, 
like a page viewer, search variables and such. I use post if the 
data being submitted causes changes (other than logging and such). 
Anything you want to be bookmarked you pass with get.
Sunanda
15-Nov-2005
[322]
Get is also repeatable....useful if you have a convoluted script 
or need to re-read the variables (eg in an error handler to log what 
triggered the problem).
Whereas post reads from a port and exhausts its input.
Volker
1-Dec-2005
[323]
Is there an example for temple somewhere? Was quite surprised google 
found nothing, and i got the source finally through detective. Now 
i need to get the cgi started and a simple demo.
Chris
1-Dec-2005
[324]
Has it actually been released?  I thought last word was that it was 
due for some optimization...
Pekr
5-Dec-2005
[325x4]
I just today was supposed to do quick small form maintanance using 
Rebol. My friend gave-up on php, as he can't code. So - basically 
it all worked, I just have few questions:
1) How do I prevent printing rebol output, e.g. error messages to 
the browser? What is general aproach here? Should it be avoided to 
not eventually disclose script's content?
2) how secure is following? 

str: copy ""
result: decode-cgi read-cgi

foreach [word valu] result [append str join "" [word ":    " value 
newline]


I mean - above block in 'join statement is reduced - is it secure?
3) I have older version of rebcmd from linux sdk I bought. But it 
did not used 'read-cgi at that time (well, here we are with SDK coming 
late ;-) My question is - I uploaded rebol core into cgi-bin directory:
a) is it desirable aproach or should it be avoided?

b) how do I assure, that if I ftp rebol executable to cgi-bin dir, 
to have sufficient right of the target directory, so that it could 
be run?
Graham
5-Dec-2005
[329]
mostly that's where i put it .. I can't put it anywhere else
Pekr
5-Dec-2005
[330x2]
ok, now I tried it, Graham. I used Total Commander to copy it over 
ftp there. I got correct user and group permissions, but I had to 
chmod it directly on server to 755
what should I do to not need it?
Graham
5-Dec-2005
[332]
Huh?
Pekr
5-Dec-2005
[333]
what permission does rebol need in linux filesystem?
Graham
5-Dec-2005
[334x2]
most hosts set up perl is some bin directory and the shebang points 
to that... but most hosts won't do that for rebol for you.  so,you 
have to put rebol in the cgi-bin
I think I just use 755
Pekr
5-Dec-2005
[336x2]
-rwxrwxr-x  1 cod-okna cod-okna   1504 Dec  5 22:24 pokus.cgi
-rwxrwxr-x  1 cod-okna cod-okna    284 Jan  3  2004 pokus.r
-rwxrwxr-x  1 cod-okna cod-okna 366148 Dec  5 11:26 rebol
yes, but the trouble is, that when I copied it there, it had something 
even lower ...
Graham
5-Dec-2005
[338]
when you copy it, it is made not executable.. you have to change 
it
Pekr
5-Dec-2005
[339x2]
IIRC there was something like "s"  - sticky bit for particular directory, 
but not sure if related ...
yes, but if all you have is ftp account, not console? How do you 
change it?
Graham
5-Dec-2005
[341]
ftp client can do that for you
Pekr
5-Dec-2005
[342x2]
what permission shouls scripts have, 755 or 775?
maybe I use 775 and it it not needed it to have it so high?
Graham
5-Dec-2005
[344x2]
doesn't need to be able to be read
I mean group or world write
Volker
5-Dec-2005
[346x2]
1) should be secure. decode-cgi should put only strings in the data, 
nothing executable. (i use a lot "should" when it comes to security 
and i did not double-check).
But why do you do that? simply 
 mold decode-cgi
should give the same.
correction, that response was for 2)