Rev as CGI - regular lackings...

Pierre Sahores psahores at easynet.fr
Mon Sep 1 06:38:00 EDT 2003


Hi List, Scott,

In learning how to setup a Rev's sockets listener CGI engine, i get
reccurent errors (one for each six calls to the CGI engine).

The intereting point is that my test client-side script did'nt get the
expected answer from the CGI with a "swiss made" regularity ??!

This script send in a repeat loop a sequence of 20 "POST" method calls
to the CGI.

For five to six times, all works fine : the client-side script get its
answer from the CGI script but, the next forcoming time, he only get 19
of the 20 expected answers...

Each call lacking in the sequence of 20 calls is :

sequence 6 : the call number 2
sequence 12 : the call number 4
sequence 18 : the call number 6
sequence 24 : the call number 8
sequence 30 : the call number 10
sequence 36 : the call number 12
sequence 42 : the call number 14
sequence 48 : the call number 16
sequence 54 : the call number 18
sequence 60 : the call number 20

and then, again

sequence 66 : the call number 2
sequence 72 : the call number 4
...

and soo on...

Here is the client side script, running from inside an active stack :

> on mouseUp
>   if the shiftkey is down then edit script of me
>   else testconn
> end mouseUp
> 
> on testconn
>   put the seconds into time1
>   set cursor to watch
>   set the thumbposition of sb "jauge" to "0"
>   put "10" into aa
>   put "ee946=941&TTF=azertyytreza" into ttest
>   repeat with ltr = 1 to 20
>     if the seconds - time1 > 10 then exit repeat
>     set httpheaders to "Content-type: application/x-www-form-urlencoded" & return
>     # post ttest to url (fld "csrecents")
>     post ttest to url ("http://localhost/cgi-bin/wmc.rev")
>     if it contains "ee946=941&TTF=azertyytreza" then add 1 to qconnect
>     else put ltr & " " after tconnect
>     set the thumbposition of sb "jauge" to aa
>     add 10 to aa
>   end repeat
>   if qconnect = 20 then
>     answer "La connexion avec le serveur distant est OK" & return & \
>         "(succès des tests de" && (qconnect div 20)*100 & "% en" && the seconds - time1 && "secondes)."
>   else if qconnect > "0" then
>     set the thumbposition of sb "jauge" to "0"
>     answer "La connexion avec le serveur distant est instable." & return & return & \
>         "Vérifiez votre configuration d'accès à l'internet" & return & "avant de poursuivre." & return & return & \
>         "(succès des tests de" && qconnect & "/20 (" & char 1 to -2 of tconnect & ")" && "en" && the seconds - time1 && "secondes)"
>   else if qconnect = "" then
>     set the thumbposition of sb "jauge" to "0"
>     answer "La connexion avec le serveur distant est rompue." & return & return & \
>         "Vérifiez votre configuration d'accès à l'internet" & return & "avant de poursuivre." & return & return & \
>         "(succès des tests de" && (qconnect div 20)*100 & "% en" && the seconds - time1 && "secondes)"
>   end if
> end testconn

and here the cgi script :

> #!mc
> 
> on startup
> 
> start using stack "liburl" -- idem with/without starting it
> 
> if $REQUEST_METHOD is "POST" then
> 
> repeat while the length of buffer < $CONTENT_LENGTH
> read from stdin until empty
> put it after buffer
> end repeat
> 
> else
> 
> put "<HTML><HEAD><TITLE>ERROR: File Not Found</TITLE></HEAD>" & \
>     "<BODY background='/gif/fond-maison.gif'><H1>File Not Found</H1><P>" & \
>     "<H3>The file you have requested does not exist on this server.</H3>" & \
>     "</BODY></HTML>" into buffer
> 
> end if
> 
> put "Content-Type: text/html" & return & "Content-Length:" && \
> the length of buffer & return & return & buffer
> 
> end startup

Both the client and cgi are running under the MC 2.5 issue of the engine under Suse-Linux 8.2 Pro.

Any idea about solving this (get always 20 replies for each sequence of 20 calls) would be really helpfull.

Thanks to All,

Best Regards, Pierre
-- 
Bien cordialement, Pierre Sahores

Inspection académique de Seine-Saint-Denis
Applications et SGBD ACID SQL (WEB et PGI)
Penser et produire "delta de rentabilité"




More information about the use-livecode mailing list