bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13857: Unhandled case in module/web/response.scm


From: Daniel Hartwig
Subject: bug#13857: Unhandled case in module/web/response.scm
Date: Sun, 3 Mar 2013 08:47:55 +0800

Hello

Which version of guile are you using?  Is it from recent git?  There
are perhaps related fixes to the web modules made since January.

On 2 March 2013 15:21, Jason Earl <address@hidden> wrote:
>
> response.scm does not seem to handle the case where the server does not
> specify a content length.  Here's a minimal example that should work,
> but doesn't:

For non-chunked responses, Content-Length is _almost_ always present.

>
> --8<---------------cut here---------------start------------->8---
> #!/usr/local/bin/guile -s
> !#
>
> (use-modules (srfi srfi-8)
>              ((web uri)    #:select (string->uri))
>              ((web client) #:select (http-get)))
>
> (receive (res-headers res-body)
>     (http-get (string->uri 
> "http://www.blogger.com/feeds/4777343509834060826/posts/default";))
>   (display res-body)
>   (newline))
> --8<---------------cut here---------------end--------------->8---

On my testing, this server is using chunked transfer encoding in the
response, and your patch should have no effect on that?

>
> Now the reason that I started experimenting with guile in the first
> place was that I wanted to learn more about scheme, and fixing this
> seemed like a good opportunity at a practical application of my basic
> scheme skills.
>
> So I did a little debugging and created this little patch that fixes
> this issue.
>
>
>
> With that patch my little test program works.
>
> Now, please forgive my ignorance.  I probably misunderstand what
> "delimited" means in this context, and I am probably using it
> incorrectly.  I would be shocked if this even slightly resembles how
> this should be fixed.  I have been lurking on the guile mailing lists
> for a few months and I don't understand half of what you guys are
> talking about (which is actually why I am so keen to play with guile).
> Sharing this patch seemed to be the easiest way to explain what is
> happening.
>
> I am not even going to pretend that I have spent a great deal of time
> reading the HTTP 1.1 protocol specs, but it does appear that the server
> does not have to return a Content-Length.  I certainly have run across
> servers that don't.
>
> Poking at this issue has been quite a bit of fun for me.  So, thanks for
> all of your hard work on the system.  Now I must admit that I am
> interested in seeing how (and if) this gets fixed.
>
> Jason
>

Your undelimited port has only one feature on top of a regular port:
handle #:keep-alive?.  Note that this HTTP option is not usable unless
the response includes a Content-Length header :-).

Regards





reply via email to

[Prev in Thread] Current Thread [Next in Thread]