bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] Send Content-Length with POST 0 length body


From: Darshit Shah
Subject: Re: [Bug-wget] Send Content-Length with POST 0 length body
Date: Mon, 20 Oct 2014 18:48:40 -0700

I think we should handle PUT and POST alone. And add additional logic to
handle a 411 response to any request.

Wget has traditionally supported POST requests and PUT has a very similar
usage, for anything else, the user should use the - - send-header commands.
On 20-Oct-2014 1:16 pm, "Tim Rühsen" <address@hidden> wrote:

Am Montag, 20. Oktober 2014, 20:08:05 schrieb Matthew Atkinson:
> On 20/10/14 16:26, Giuseppe Scrivano wrote:
> > should we do this only for POST requests?  What about doing it in any
> > case that "!(opt.body_data || opt.body_file)"?
> >
> > Regards,
> > Giuseppe
>
> From http://tools.ietf.org/html/rfc7230#section-3.3.2
>
> > A user agent SHOULD send a Content-Length in a request message when
> > no Transfer-Encoding is sent and the request method defines a
> > meaning for an enclosed payload body.  For example, a Content-Length
> > header field is normally sent in a POST request even when the value
> > is 0 (indicating an empty payload body).  A user agent SHOULD
> > NOT send a Content-Length header field when the request message
> > does not contain a payload body and the method semantics do not
> > anticipate such a body.
>
> I would think that we should do this for POST and PUT, but nothing
> else

Since Wget does not explicitly support PUT, we may just care for the POST
request. Since servers may reject a POST without Content-Length, we are
better
off with supplying one. Since PUT (and also PATCH) request 'anticipate' a
body,
we could also care for these.

Matthew, could you also check for 'put and 'patch' request and send an
amended
version of the patch. FYI, HTTP PATCH request is rfc5789.


RFC 7230
3.3.2. Content-Length

   A user agent SHOULD send a Content-Length in a request message when
   no Transfer-Encoding is sent and the request method defines a meaning
   for an enclosed payload body.  For example, a Content-Length header
   field is normally sent in a POST request even when the value is 0
   (indicating an empty payload body).  A user agent SHOULD NOT send a
   Content-Length header field when the request message does not contain
   a payload body and the method semantics do not anticipate such a
   body.


RFC7231
6.5.10. 411 Length Required

   The 411 (Length Required) status code indicates that the server
   refuses to accept the request without a defined Content-Length
   (Section 3.3.2 of [RFC7230]).  The client MAY repeat the request if
   it adds a valid Content-Length header field containing the length of
   the message body in the request message.


Tim


reply via email to

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