http server hangs on post without enctype="multipart/form-data"

2008-11-22 Thread Tomas Hlavaty
Hi Alex, I have the following code: === (load "@lib/http.l" "@lib/xhtml.l" "@lib/form.l") (de done () (msg "done") (html 0 "done" NIL NIL "Finito" ) ) (de start () (html 0 "start" NIL NIL (prin " ") (prin " ") ( NIL "@done" ( 'n1 'v1) (

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
Hi Tomas, yes, this is a bug. It hangs in (line), as you suspected. We discussed this problem some time ago with Henrik in the chat. The server is indeed waiting for either an EOL or EOF. When the browser uses HTTP/1.1, together with the "Keep-Alive" option, it does not send an EOF after a single

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Henrik Sarvell
And I documented my solution here: http://www.prodevtips.com/2008/10/06/jquery-and-pico-lisp/ (it works around the problem by changing jQuery instead of Pico). It's a way to make the jQuery (http://jquery.com) Ajax by POST work properly with PicoLisp. Ironically the target application - a kind of

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
Hi Alex & Henrik, >> but to read the "Content-Length" in '_htHead', and then replace (line) >> with >> >> (make >> (for (N *ContLen (gt0 N)) >> (dec 'N (size (link (char ) ) >> > (it works around the problem by changing jQuery instead of Pico). thanks for suggestions, I'll hav

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Henrik Sarvell
Just out of curiosity, why are you not allowed to use multipart/form-data, what breaks if you do? /Henrik On Sun, Nov 23, 2008 at 4:15 PM, Tomas Hlavaty <[EMAIL PROTECTED]> wrote: > Hi Alex & Henrik, > >>> but to read the "Content-Length" in '_htHead', and then replace (line) >>> with >>> >>> (

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
Hi Alex, >> >> (for (N *ContLen (gt0 N)) >> >> (dec 'N (size (link (char ) ) > > Hmm, sorry, this also seems not to work :-( > > The problem is that (char) does a single-character look-ahead, so it > will also hang. I just found it too, it hangs on the last char:-( > At the mome

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
Hi Henrik, > Just out of curiosity, why are you not allowed to use > multipart/form-data, what breaks if you do? I did not write the form and I cannot change it to say multipart/form-data as it is provided by a 3rd party. Cheers, Tomas -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
On Sun, Nov 23, 2008 at 10:29:35AM +, Tomas Hlavaty wrote: > What about using 'peek' on the last char? Yes, this might do. > A C function 'char1' might be fastest fix probably. Or 'ht:Read' in "src/ht.c", usable as: (ht:Read *ContLen) Cheers, - Alex -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
> I was thinking about rewriting the server, I already wrote a > prototype asynchronous http server but I have only the reading part > non-blocking and not the writing part yet. I do not want to spend > too much time on it right now. Sorry, I was not clear. It would not have to be a asynhronous

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
An even better solution might be to extend the built-in 'line' function in that a way that when only a single 'cnt' argument is passed it is taken as a length parameter. The idea is that in the current semantics of 'line' a single 'cnt' argument makes no sense. Cheers, - Alex -- UNSUBSCRIBE: mail

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
> An even better solution might be to extend the built-in 'line' function > in that a way that when only a single 'cnt' argument is passed it is > taken as a length parameter. The idea is that in the current semantics > of 'line' a single 'cnt' argument makes no sense. But would cnt mean number of

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
Hi Alex, I have attached the fixed server. It does not hang and also allows you to get http query vars in assoc list (see *HtVars and *HtVarsHook). Are you happy with it like that and would it be possible to put it in the release? > this works for me. Not sure about the consequences of not rea

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
On Sun, Nov 23, 2008 at 10:55:33AM +, Tomas Hlavaty wrote: > But would cnt mean number of chars or number of bytes? That could be > confusing. Oops, right. Not a good idea ;-) -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
On Sun, Nov 23, 2008 at 10:56:47AM +, Tomas Hlavaty wrote: > this works for me. Not sure about the consequences of not reading the > last char though. Do we have to read it? I think that not reading the last char might give problems. As the connection is not closed (which was the primary rea

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
Hi Tomas, > Are you happy with it like that and would it be possible to put it in > the release? Hmm, sorry. I appreciate your improvements, but I don't want to diversify the server too much. It is intended as an application server after all (as opposed to a general purpose web server), and shoul

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
Hi Tomas & Henrik, > >> (for (N *ContLen (gt0 N)) > >> (dec 'N (size (link (char ) ) Hmm, sorry, this also seems not to work :-( The problem is that (char) does a single-character look-ahead, so it will also hang. At the moment I see no way how to do it on the Lisp level, i.e.

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
Hi Alex, >> The problem is that (char) does a single-character look-ahead, so it >> will also hang. > > I just found it too, it hangs on the last char:-( > >> At the moment I see no way how to do it on the Lisp level, >> i.e. without writing a C-function, and without completely changing >> the par

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
On Sun, Nov 23, 2008 at 01:16:55PM +0100, Alexander Burger wrote: > Let me investigate a solution like (ht:Read *ContLen), returning a > single-char-line for a given number of bytes. OK, I've built this now. The 'ht' library has a new function 'Read'. I had also to change "lib/form.js" (remove the

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
Hi Tomas, > you to get http query vars in assoc list (see *HtVars and > *HtVarsHook). Sometimes it is possible to make application-specific changes or extensions dynamically at application startup, without the need to modify the system files. For example, your extension of '_htSet' > (de _htSet

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
Hi Alex, thanks for fixing it. Tomas -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
Hi Alex, >(redef _htSet @ > (if (and *HtVarsHook (*HtVarsHook)) > (push '*HtVars (cons (pack (next)) (next))) > (pass _htSet) ) ) thank you, I will use this;-) Tomas -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Tomas Hlavaty
Hi Alex, isn't semantics of 'peek' and 'char' a bit "strange"? I would expect 'char' to block and return next character when available and 'peek' return the next character if available otherwise return "nothing" without blocking. I think that once I get something from peek, I should be able to g

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
Henrik + Tomas, many thanks for pointing out this bug! I feel much better now :-) Cheers, - Alex -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-23 Thread Alexander Burger
Hi Tomas, > I would expect 'char' to block and return next character when > available and 'peek' return the next character if available otherwise > return "nothing" without blocking. On that level there is no concept of blocking. Data are read as a logical stream. Something similar to what you su

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-26 Thread Tomas Hlavaty
Hi Alex, > My suspicion is that it has something to do with Keep-Alive, and one just a thought: even if the client sends keep-alive, the server can respond close and close the connection. Is there any particular reason you do not want to close the connection after you served the request? Would y

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-26 Thread Alexander Burger
On Wed, Nov 26, 2008 at 12:27:48PM +, Tomas Hlavaty wrote: > respond close and close the connection. Is there any particular > reason you do not want to close the connection after you served the Yes, keep-alive was the main reason why I switched to HTTP/1.1 around the end of 2006. It speeds

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-26 Thread Tomas Hlavaty
Hi Alex, > Sometimes POST seems to lose data, or contain data out of > context. No idea yet, but I observe this once every few weeks, and > I'm tracing the activities now. I haven't noticed this yet but I'll let you know if I do;-) Cheers, Tomas -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-26 Thread Alexander Burger
Hi Tomas, > it works for me now with ht:Read. Fine! :-) > Would it be possible to put comment into CHANGES file? Usually I mention there only kernel changes (though until 2006 I regarded some GUI parts also as belonging to the kernel). At the moment I'm still searching for a Heisenbug, occasi

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-26 Thread Tomas Hlavaty
Hi Alex, it works for me now with ht:Read. Would it be possible to put comment into CHANGES file? Do you use any version control system? Thanks, Tomas -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Re: http server hangs on post without enctype="multipart/form-data"

2008-11-26 Thread Alexander Burger
Hi Tomas, > I haven't noticed this yet but I'll let you know if I do;-) Would be nice if you detect something. It will probably soon drive me crazy ;-) I cannot reproduce it myself, but I see it happening. My suspicion is that it has something to do with Keep-Alive, and one HTTP transaction conf

Re: http server hangs on post without enctype="multipart/form-data"

2008-12-04 Thread Alexander Burger
On Wed, Nov 26, 2008 at 01:16:10PM +0100, Alexander Burger wrote: > My suspicion is that it has something to do with Keep-Alive, and one > HTTP transaction conflicting with the other. The symptoms differ, > though, sometimes '*Gui' does not match the form in '*Post', sometimes > '*Get' or other hid