From: Pascal B. <pj...@in...> - 2017-03-30 23:29:19
|
> On 31 Mar 2017, at 00:55, Jean Louis <bu...@gn...pport> wrote: > > On Thu, Mar 30, 2017 at 10:10:48PM +0200, Pascal Bourguignon wrote: >> Neither using LISTEN or directly READ-SEQUENCE are good solutions. >> Either one will work only by chance. > > I guess that is deeper foundation of how it works. On my side it works > now well, so it will work in practice. > It will work until the system is loaded and the web server is interrupted between fork/execing the CGI, and writing the parameter. >> LISTEN in particular will fail, if for whatever reason, the web >> server didn’t start writing the PUT data or POST parameters to the >> CGI pipe, when the CGI calls LISTEN. I guess the same is true with >> READ-SEQUENCE: it won’t read an end-of-file if the web server >> doesn’t close that pipe. > > OK, maybe, I don't know, I cannot say. I just test it on 2-3 > webservers, those I use also remotely, if it works locally, it works > remotely, then I leave it working for years. Good luck! Be sure to put your name on any system you program like that, so I don’t use them and don’t risk a painful death. > >> And let me you ask the question: what reason does the web server >> have to close that pipe if it didn’t have to write anything to it, >> because it was a GET request? >> >> The correct solution, as always, is to read the documentation, >> specifically, the RFC 3875 <https://tools.ietf.org/html/rfc3875> > >> Or you may browse the Wikipedia summary, and find out that the CGI >> specifies that the environment variable REQUEST_METHOD will indicate >> whether it’s a GET, a PUT, a POST or whatever else. You must test >> this before trying to read stdin! > >> >> >> (defun main (&optional (arguments *args*)) >> (let ((method (getenv "REQUEST_METHOD"))) >> (cond ((or (string= method "PUT") >> (string= method "POST")) > > Thank you. > > I have just shown the sample, in reality I am testing for QUERY_STRING > to get the GET parameters, if none, I test for *standard-input*, and > later for certain parameters, if they are missing, it goes to error > handling. QUERY_STRING is present when REQUEST_METHOD=POST ! And there is an intersection of values for QUERY_STRING for both GET and POST. -- __Pascal J. Bourguignon__ |