[REBOL] Re: CGI: debug mode Re:

2000-09-01 Thread alex . pini

>- Open Your Mind -<



Quoting from [EMAIL PROTECTED]'s message (01-Sep-00 09:55:57).

m> I've seen it in a lot of CGI Rebol scripts: place the 'print
m> "Content-type: text/html"' first.
m> 
m> I don't like it myself, but I use it sometimes when I run into trouble,
m> until the script is fully tested, then I put it in place again.

I do, too (during the debug phase, then I comment it away), but you may have missed 
the point: the script never issued that first print because of an early error, one 
that went off *before* the script started. That's what kept me in the dark for so 
long. Apache logs didn't help me much either, because they just reported incomplete 
headers, which I thought the script was printing well... :-?




Alessandro Pini ([EMAIL PROTECTED])

"FBI. F... B... I!!" (Mulder (van Blundht))




[REBOL] Re: CGI: reading POST-method data with read-io Re:(2)

2000-08-25 Thread g . santilli

Hello [EMAIL PROTECTED]!

On 25-Ago-00, you wrote:

 p> Could you be more specific, please? How do you want to
 p> substitute read-io read-by-buffer-size-parts functionality?

You need to use READ-IO when you a) want the raw data and b) don't
want to wait for the remote part to close the port. COPY/PART had
a similar functionality on /BINARY TCP ports, but it still waited
if there were no data in the port. Now you can just use COPY or
COPY/PART, because it no more waits for data. 

Imagine a client-server communication. With the new experimental
core:

Asynchronous communication:

Server:
>> listen: open tcp://:1
>> conn: first listen

Client:
>> conn: open tcp://localhost:1
>> insert conn "hello server!"

Server:
>> copy conn
== "hello server!"
>> insert conn "hello client!"

Client:
>> copy conn
== "hello client!"

and so on.

Synchronous communication:

Server:
>> listen: open/wait tcp://:1
>> conn: first listen

Client:
>> conn: open tcp://localhost:1
>> insert conn "1234567890"

Server:
>> copy/part conn 20
(waits...)

Client:
>> insert conn "1234567890"

Server:
(ends waiting)
== "12345678901234567890"

You don't even need to use a cycle if you use syncronous
operations (which you can use if you don't need to handle
multiple connections or other events).

Regards,
Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/




[REBOL] Re: CGI: reading POST-method data with read-io

2000-08-24 Thread g . santilli

Hello [EMAIL PROTECTED]!

On 24-Ago-00, you wrote:

 a> I've read the User's Guide, the old FAQs, the how-to and the
 a> recent Networking chapter, but I still lack insight on the
 a> inner workings of read-io. I can make conjectures, they may
 a> even work, but I don't like that: in the long run, I could
 a> accumulate all sorts of mistakes.

I hope I can help...

 a> -- Buffer --

 a> We need a buffer. If we need to read 2000 bytes, the buffer is
 a> made 2002 bytes long with

 a>data1: make string! 2002

(This is probably a bug. I think it was going to be fixed...)

 a> I guess the extra 2 bytes are needed to store ancillary
 a> information, but their content is not my concern, for now. Can
 a> we make the buffer as in

 a>data2: make string! 2000

You should be able to, but it creates problems if the length is a
multiple of 16. I had a lot of troubles because of this... :-)

 a> or even

 a>data3: copy ""

READ-IO is very low-level, and does not extend the string. Anyway,
since the new experimental release of core has asyncronous TCP
ports, READ-IO should no more be needed.

 a> -- Correct buffer-length --

 a> According to CGI quasi-official specs, once I've checked the
 a> message body is in URL-encoded format, I must read no more
 a> than CONTENT_LENGTH bytes from system/ports/input. So if I
 a> want to go elegant and read *exactly* CONTENT_LENGTH bytes I
 a> make my buffer exactly 2 bytes longer than that and use
 a> read-io to read exactly CONTENT_LENGTH bytes, so I don't waste
 a> memory in a prudent 128 MB buffer, right?

Yup.

 a> -- Data readiness --

[...]
 a> CONTENT_LENGTH is, say, 22000 bytes, what happens if I request
 a> my 22000 bytes but only 1000 are available? Will read-io
 a> return the 1000 bytes immediately (which means I have to do

Yes.

Regards,
Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/




[REBOL] Re: CGI and /view

2000-06-15 Thread kolla

On Wed, 14 Jun 2000 [EMAIL PROTECTED] wrote:

> Hello all,
> 
> On my setup (NT and Apache), I only succeeded to use /Core for CGI.
> Not /View.
> 
> In my rebol headers,
> 
> #!c:/rebol/rebol.exe -cs would work.
> 
> #!c:/rebol/view/rebol.exe -cs won't work. After executing the script
> from my web browser, it just waits indefinetely...

Pining for $DISPLAY perhaps? :)


-- kolla




[REBOL] Re: CGI Re:

2000-06-13 Thread rebol

Hello [EMAIL PROTECTED],

I don't know much about how the NT filesystem, but I _suspect_ this is what's 
happening:
To determine if a file exists, REBOL tries to get a filesystem lock on the file or 
directory (this is happening on Amiga at least, verified with snoopdos). The result of 
this action (success/failure) determines the result of exists?
AFAIR directory locks are mostly used to read the contents of a directory, so it might 
be that the user under which the rebol/cgi script is running does not have the 
required priviledges to do a directory-listing.

Try doing a (print what-dir) and a (list-dir) in the "other" script (ie. not the cgi 
one).

Best regards
Thomas Jensen


On 13-Jun-00, [EMAIL PROTECTED] wrote:

> 
> 
>> Just a guess, but does the same happen if you add a trailing slash, ie:
>> print exists? %./
> 
> Yes it does.
> I guess it has to do with file permissions.
> I'm running NT, the script does some stuff on files but it's local.
> The rebol script invoked with the do/args is outside of the cgi-bin
> directory defined in Apache. Is this a problem ? (it runs fine, it
> just seems oblivious to what local files pertains).
> 
> daniel
> 
>> On 13-Jun-00, [EMAIL PROTECTED] wrote:
> 
>>> 
>>> Can someone help me with the following :
>>> 
>>> Consider this : print exists %.
>>> 
>>> In other words, does the current directory exists ? (which has to be always
>>> true).
>>> 
>>> However, when this line is called from a CGI script (it's not part of
>>> the CGI script itself, but part of a rebol script called with "do/args" from
>>> the CGI script), it produces "false".
>>> 
>>> I'm running Apache.
>>> 
>>> daniel




[REBOL] Re: CGI Re:

2000-06-13 Thread danielsz



> Just a guess, but does the same happen if you add a trailing slash, ie:
> print exists? %./

Yes it does.
I guess it has to do with file permissions.
I'm running NT, the script does some stuff on files but it's local.
The rebol script invoked with the do/args is outside of the cgi-bin
directory defined in Apache. Is this a problem ? (it runs fine, it
just seems oblivious to what local files pertains).

daniel

> On 13-Jun-00, [EMAIL PROTECTED] wrote:

>> 
>> Can someone help me with the following :
>> 
>> Consider this : print exists %.
>> 
>> In other words, does the current directory exists ? (which has to be always
>> true).
>> 
>> However, when this line is called from a CGI script (it's not part of
>> the CGI script itself, but part of a rebol script called with "do/args" from
>> the CGI script), it produces "false".
>> 
>> I'm running Apache.
>> 
>> daniel


> Best regards
> Thomas Jensen



--
[EMAIL PROTECTED]
http://perso.worldonline.fr/mutant






[REBOL] Re: CGI

2000-06-13 Thread rebol

Hello [EMAIL PROTECTED],

Just a guess, but does the same happen if you add a trailing slash, ie:
print exists? %./

On 13-Jun-00, [EMAIL PROTECTED] wrote:

> 
> Can someone help me with the following :
> 
> Consider this : print exists %.
> 
> In other words, does the current directory exists ? (which has to be always
> true).
> 
> However, when this line is called from a CGI script (it's not part of
> the CGI script itself, but part of a rebol script called with "do/args" from
> the CGI script), it produces "false".
> 
> I'm running Apache.
> 
> daniel


Best regards
Thomas Jensen





[REBOL] Re: cgi and post

2000-02-21 Thread giesse

Hello [EMAIL PROTECTED]!

On 20-Feb-00, you wrote:

 s>  tmp: load system/options/cgi/content-length
 s>  buffer: make string! (tmp + 10)
 s>  read-io system/ports/input buffer tmp

AFAIK this could not read all the data. I think it's better to use
something like:

while [tmp > 0] [tmp: tmp - read-io system/ports/input buffer tmp]

 s> system/options/cgi/content-length but it is quaranteed that
 s> content-length will be send everytime by each browser (or
 s> another user-agent)? (question for Holger?)

The browser MUST include the Content-Length header if it is
sending data. If it doesn't, the server cannot tell how much data
to wait for.

 s> what about reading stdin by this way:

 s> instr: make string! 5 * 1024 while [found? tmp: pick
 s> system/ports/input 1][append instr tmp]

Rather slow IMHO... and it will not work in case of binary data
(well, that shouldn't be your case anyway).

Regards,
Gabriele.
-- 
o) .-^-. (--o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
o) `-v-' (--o




[REBOL] Re: cgi scripts - error traping Re:

1999-12-15 Thread JavierD

Hola [EMAIL PROTECTED]


El 14-Dec-99, usted escribio:

> if error? try [print cgi/dia] [
> ; what to do in case of an error goes here
> ]
> 
> if you are unfamilar with 'error? and 'try take a look at 

where i can get more info about error ?
is in the user guide?

> Good luck!

Thank you  for help me =8-)> 

Atentamente, Javier Delgado
-- 
Paralax Multimedia S.A.   Mexico D.F.
http://www.paralax.com.mx

Producción de Video, Video3d, animacion 3d  kioskos
tel/fax <5>373 36 20 , Calzada de las Armas16 Naucalpan
--
Personal  http://www.paralax.com.mx/Javier   
http://www.paralax.com.mx/Eyim
icq :   40740225  JavierD




[REBOL] [REBOL] Re: CGI-Hit Counter Re:(6)

1999-11-09 Thread jim

I'm not getting any..

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 08, 1999 12:05 PM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] [REBOL] CGI-Hit Counter Re:(6)
>
>
> Is it just me that's getting dupes of mails ???
>
> Martin
>



[REBOL] [REBOL] Re: CGI-Hit Counter

1999-11-08 Thread hassel

[EMAIL PROTECTED] wrote:
>
> Is it just me that's getting dupes of mails ???
>
> Martin
>

Nope, me also...

Bye,

Anders Hasselqvist



[REBOL] [REBOL] Re: CGI-Hit Counter

1999-11-08 Thread jim

Okay, I take it back.  I got a dup.  But just one.

Jim

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 08, 1999 1:36 PM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Re: CGI-Hit Counter
>
>
> [EMAIL PROTECTED] wrote:
> >
> > Is it just me that's getting dupes of mails ???
> >
> > Martin
> >
>
> Nope, me also...
>
> Bye,
>
> Anders Hasselqvist



[REBOL] RE: CGI-Hit Counter

1999-11-08 Thread jim

Okay, I take it back.  I got a dup.  But just one.

Jim

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 08, 1999 1:36 PM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Re: CGI-Hit Counter
> 
> 
> [EMAIL PROTECTED] wrote:
> > 
> > Is it just me that's getting dupes of mails ???
> > 
> > Martin
> > 
> 
> Nope, me also...
> 
> Bye,
> 
> Anders Hasselqvist



[REBOL] Re: CGI-Hit Counter

1999-11-08 Thread hassel

[EMAIL PROTECTED] wrote:
> 
> Is it just me that's getting dupes of mails ???
> 
> Martin
> 

Nope, me also...

Bye,

Anders Hasselqvist



[REBOL] RE: CGI-Hit Counter Re:(6)

1999-11-08 Thread jim

I'm not getting any..

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 08, 1999 12:05 PM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] [REBOL] CGI-Hit Counter Re:(6)
> 
> 
> Is it just me that's getting dupes of mails ???
> 
> Martin
> 



[REBOL] Re: CGI-Hit Counter Re:(2)

1999-01-04 Thread giesse

Hello [EMAIL PROTECTED]!

On 05-Nov-99, you wrote:

 w>> Then in the cgi/exec script:
 w>> 1) Do all The Usual Stuff to increment and save the hit
 w>> counter; 2) Convert the (numeric) hit counter value to
 w>> decimal (ASCII string or array of decimal digits); 3) Output
 w>> HTML which pulls in the appropriate images, one per digit, in
 w>> a single row without whitespace between the tags.

 w> That's a good scheme, but it means all pages you want to
 w> count have to be wrapped by a cgi-bin script as opposed to
 w> just adding an img tag that points to a script within them.

There's a way inbetween. Use something like:



in the html and make the counter return the rigth digit. The
counter may be incremented by another script or just when the most
significant digit is requested.

Regards,
Gabriele.
-- 
o) .-^-. (--o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
o) `-v-' (--o