I am using http-request to upload files on some web-site. The problem is that sometimes the function returns a nil response so I just have to repeat it again with the same parameters. Sometimes it take up to 8 retries to make the request return a non-nil response. I wonder if you saw it before or how can I debug it? The function doesn't take long to return with nil result. I mean the whole file upload can take 10 seconds, so the http-request may return nil within those 10 seconds. Is some timeout or the connection gets broken between the hosts? There is no exception raised as well, it just silently returns nil.
Thank you, Andrew
On Fri, 9 May 2008 14:48:10 -0400, "Andrei Stebakov" lispercat@gmail.com wrote:
I am using http-request to upload files on some web-site. The problem is that sometimes the function returns a nil response so I just have to repeat it again with the same parameters. Sometimes it take up to 8 retries to make the request return a non-nil response. I wonder if you saw it before or how can I debug it? The function doesn't take long to return with nil result. I mean the whole file upload can take 10 seconds, so the http-request may return nil within those 10 seconds. Is some timeout or the connection gets broken between the hosts? There is no exception raised as well, it just silently returns nil.
Hmm, it should definitely not just silently return NIL, but we probably need a tiny little bit more info from you:
Which Lisp? Which operating system? Which version of Drakma and Chunga? Have you tried to trace the headers when this happens?
http://weitz.de/drakma/#*header-stream*
Is this a public URL so we can try to reproduce your problem?
Edi.
Unfortunately it's not a public url, and it uses some authorization tokens in the request, so I can't disclose it. I am using drakma-0.11.5 and chunga-0.4.2 on Ubuntu with sbcl-1.0.15. I am going to use *header-stream* to see if it gives some clue.
Andrew
On Fri, May 9, 2008 at 3:21 PM, Edi Weitz edi@agharta.de wrote:
On Fri, 9 May 2008 14:48:10 -0400, "Andrei Stebakov" lispercat@gmail.com wrote:
I am using http-request to upload files on some web-site. The problem is that sometimes the function returns a nil response so I just have to repeat it again with the same parameters. Sometimes it take up to 8 retries to make the request return a non-nil response. I wonder if you saw it before or how can I debug it? The function doesn't take long to return with nil result. I mean the whole file upload can take 10 seconds, so the http-request may return nil within those 10 seconds. Is some timeout or the connection gets broken between the hosts? There is no exception raised as well, it just silently returns nil.
Hmm, it should definitely not just silently return NIL, but we probably need a tiny little bit more info from you:
Which Lisp? Which operating system? Which version of Drakma and Chunga? Have you tried to trace the headers when this happens?
http://weitz.de/drakma/#*header-stream*
Is this a public URL so we can try to reproduce your problem?
Edi. _______________________________________________ drakma-devel mailing list drakma-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel
On Fri, 9 May 2008 15:37:47 -0400, "Andrei Stebakov" lispercat@gmail.com wrote:
I am using drakma-0.11.5 and chunga-0.4.2 on Ubuntu with sbcl-1.0.15. I am going to use *header-stream* to see if it gives some clue.
If that doesn't help, try to use something like Wireshark. Or, alternatively, try with another Lisp and/or from another OS. Sometimes that makes a difference. (Which would be a bug in Drakma because it shouldn't.)
The problem was that sometimes the site responded with just headers so that content-length was 0. In this case the http-request returned request equal to nil and that confused me (I was expecting a zero length string). Now I look at the (header-value :content-length headers) and if it's zero, I get all the information I need from (header-value :location headers). I wonder if response should be nil when content-length is 0?
On Fri, May 9, 2008 at 3:44 PM, Edi Weitz edi@agharta.de wrote:
On Fri, 9 May 2008 15:37:47 -0400, "Andrei Stebakov" lispercat@gmail.com wrote:
I am using drakma-0.11.5 and chunga-0.4.2 on Ubuntu with sbcl-1.0.15. I am going to use *header-stream* to see if it gives some clue.
If that doesn't help, try to use something like Wireshark. Or, alternatively, try with another Lisp and/or from another OS. Sometimes that makes a difference. (Which would be a bug in Drakma because it shouldn't.) _______________________________________________ drakma-devel mailing list drakma-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel
On Thu, 29 May 2008 17:33:05 -0400, "Andrei Stebakov" lispercat@gmail.com wrote:
I wonder if response should be nil when content-length is 0?
The first return value of HTTP-REQUEST isn't necessarily a string, it can also be an array of octets or a stream, so there's no particular reason to assume that you'll get a string of length zero if the content length is zero. But you can, no matter if it's a string, an octet array, or NIL always check with LENGTH first.
One could argue that a zero-length array would be more appropriate, but I think returning NIL in this case is more Lisp-y.
Having said that, I realize that NIL isn't even mentioned as a potential return value, so I should probably add this to the documentation.
Do other clients have similar issues; are you sure it's not a server issue? Rob
I can't say for other clients. Even if it's a server issue, there should be some reason why the function returns nil. If server just breaks connection, there should be an exception, right? If it's a timeout, again, should be some way to know it. In this case it's probably not timeout as the function doesn't take long to return. Probably some exception is just masked somewhere in the guts of the function.
Andrew
On Fri, May 9, 2008 at 8:23 PM, Robert Synnott rsynnott@gmail.com wrote:
Do other clients have similar issues; are you sure it's not a server issue? Rob _______________________________________________ drakma-devel mailing list drakma-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel