[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: is (web client) ready for use even for the simplest task?
From: |
Nala Ginrut |
Subject: |
Re: is (web client) ready for use even for the simplest task? |
Date: |
Tue, 10 Sep 2013 17:46:24 +0800 |
On Tue, 2013-09-10 at 05:19 -0400, Mark H Weaver wrote:
> Darren Hoo <address@hidden> writes:
>
> > (use-modules (web client))
> >
> > (http-post "http://www.google.com/")
> >
> > the POST request is sent without the Content-Length header
>
> RFC 2616 makes it clear that the Content-Length header is optional.
>
I have to mention that Firefox seems not happy if the header not contain
Content-Length. When I tested Artanis redirect function under FF, it's
just halt anyway, but chrome is OK. And I fixed the issue by adding this
to response:
Content-Length: 0
That is so-called ridiculous.
But RFC 2616 wrote:
---------------------------cut----------------------------
body is not defined by this specification, but might be defined by
future extensions to HTTP. Content negotiation MAY be used to select
the appropriate response format. If no response body is included, the
response MUST include a Content-Length field with a field-value of
"0".
---------------------------end----------------------------
> > OK, let's add something to the body
> >
> > (http-post "http://www.google.com/" #:body "")
> >
> > Howcome the request now becomes an http GET request:
> >
> > GET / HTTP/1.1
> > Content-Type: text/plain;charset=utf-8
> > Host: www.google.com
> > Connection: close
>
> I just applied a fix for this to the stable-2.0 branch in git. In the
> meantime, the workaround is to explicitly pass a content-type header
> that specifies the charset, like this:
>
> (http-post "http://www.google.com/"
> #:body ""
> #:headers '((content-type text/plain (charset . "utf-8"))))
>
> > This is really ridiculous.
>
> You found a bug. It happens. There's no need to be obnoxious about it.
>
> Mark
>