Server doesn't send response code

J. Landman Gay jacque at hyperactivesw.com
Sun Apr 29 19:07:19 EDT 2012


I could still use some advice. I know at least a couple people have 
liburl working with old-style cgis. I'm running rev 3.5 and liburl 1.1.6.

This script receives and logs all paypal data but hangs, causing the 
sandbox to think it couldn't find the server:

#!rev -ui

on startup
   if $REQUEST_METHOD = "POST" then
     start using stack "liburl"
     read from stdin until empty
     put it into tOrderData
     LOG the time && "Received:" && tOrderData
     put "cmd=_notify-validate&" before tOrderData -- required response
     put "https://www.sandbox.paypal.com/cgi-bin/webscr" into tPPAddr
     post tOrderData to tPPAddr
     if the result <> "" then LOG "Post result:" && the result
     put it into tResponse -- "VERIFIED" or "INVALID"
     LOG "Response:" && it
     stop using stack "liburl"
   end if
end startup

on LOG pData
   put "paypalLog.txt" into tFile
   open file tFile for append
   write pData &cr & cr to file tFile
   close file tFile
end LOG

Five minutes after this is run, an error occurs but no specifics are 
listed in the server log, only that there was no 500 html file (which is 
how I know something went wrong.) I'm assuming it's a timeout.

Very old list messages suggest a socket may be left open. I tried both 
of these:

   set the httpHeaders to "Connection: close"  -- before the post command

and:

   repeat for each line s in the openSockets -- at the end of the script
       try
         close socket s
       catch tErr
         LOG tErr
       end try
   end repeat

Both of these cause an unspecified 500 server error. Nothing is logged.

I also tried changing the https: to plain http:, but I get a 302 
redirect and the script stops.

I know liburl is in use because it's logging some things, like the 302 
error, and I also logged the result after putting the stack in use; it 
was always empty. I don't see a way to get liburl to log to a file, so I 
don't know where it's going wrong.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list