You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Bryan Call (JIRA)" <ji...@apache.org> on 2014/08/18 20:16:20 UTC

[jira] [Comment Edited] (TS-2902) Allow POST requests without a Content-Length header

    [ https://issues.apache.org/jira/browse/TS-2902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14100985#comment-14100985 ] 

Bryan Call edited comment on TS-2902 at 8/18/14 6:15 PM:
---------------------------------------------------------

[~maskit]

I am not seeing this patch working for me.  Here is my test:

{code}
[bcall@mac-bryan-wire trafficserver]$ sudo /usr/local/bin/traffic_line -r proxy.config.http.post.check.content_length.enabled
0
[bcall@mac-bryan-wire trafficserver]$ ll foo
-rw-r--r--  1 bcall  staff     0B Aug 18 10:58 foo

[bcall@mac-bryan-wire trafficserver]$ curl -D - -o /dev/null -s -x localhost:8080 -v -d@foo -H 'Content-Length: ' http://homer.bryancall.com/post.php
* Adding handle: conn: 0x7fe723003a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fe723003a00) send_pipe: 1, recv_pipe: 0
* About to connect() to proxy localhost port 8080 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST http://homer.bryancall.com/post.php HTTP/1.1
> User-Agent: curl/7.30.0
> Host: homer.bryancall.com
> Accept: */*
> Proxy-Connection: Keep-Alive
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 400 request#no_content_length
HTTP/1.1 400 request#no_content_length
< Date: Mon, 18 Aug 2014 18:13:49 GMT
Date: Mon, 18 Aug 2014 18:13:49 GMT
* Server ATS/5.1.0 is not blacklisted
< Server: ATS/5.1.0
Server: ATS/5.1.0
< Cache-Control: no-store
Cache-Control: no-store
< Content-Type: text/html
Content-Type: text/html
< Content-Language: en
Content-Language: en
< Content-Length: 242
Content-Length: 242
< Age: 1
Age: 1
< Proxy-Connection: keep-alive
Proxy-Connection: keep-alive
< Via: http/1.1 mac-bryan-wire.bryancall.com (ApacheTrafficServer/5.1.0 [uSc s f p eN:tOc  i p sS])
Via: http/1.1 mac-bryan-wire.bryancall.com (ApacheTrafficServer/5.1.0 [uSc s f p eN:tOc  i p sS])

* HTTP error before end of send, stop sending
<
{ [data not shown]
* Closing connection 0
{code}





was (Author: bcall):
I am not seeing this patch working for me.  Here is my test:

{code}
[bcall@mac-bryan-wire trafficserver]$ sudo /usr/local/bin/traffic_line -r proxy.config.http.post.check.content_length.enabled
0
[bcall@mac-bryan-wire trafficserver]$ ll foo
-rw-r--r--  1 bcall  staff     0B Aug 18 10:58 foo

[bcall@mac-bryan-wire trafficserver]$ curl -D - -o /dev/null -s -x localhost:8080 -v -d@foo -H 'Content-Length: ' http://homer.bryancall.com/post.php
* Adding handle: conn: 0x7fe723003a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fe723003a00) send_pipe: 1, recv_pipe: 0
* About to connect() to proxy localhost port 8080 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST http://homer.bryancall.com/post.php HTTP/1.1
> User-Agent: curl/7.30.0
> Host: homer.bryancall.com
> Accept: */*
> Proxy-Connection: Keep-Alive
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 400 request#no_content_length
HTTP/1.1 400 request#no_content_length
< Date: Mon, 18 Aug 2014 18:13:49 GMT
Date: Mon, 18 Aug 2014 18:13:49 GMT
* Server ATS/5.1.0 is not blacklisted
< Server: ATS/5.1.0
Server: ATS/5.1.0
< Cache-Control: no-store
Cache-Control: no-store
< Content-Type: text/html
Content-Type: text/html
< Content-Language: en
Content-Language: en
< Content-Length: 242
Content-Length: 242
< Age: 1
Age: 1
< Proxy-Connection: keep-alive
Proxy-Connection: keep-alive
< Via: http/1.1 mac-bryan-wire.bryancall.com (ApacheTrafficServer/5.1.0 [uSc s f p eN:tOc  i p sS])
Via: http/1.1 mac-bryan-wire.bryancall.com (ApacheTrafficServer/5.1.0 [uSc s f p eN:tOc  i p sS])

* HTTP error before end of send, stop sending
<
{ [data not shown]
* Closing connection 0
{code}




> Allow POST requests without a Content-Length header
> ---------------------------------------------------
>
>                 Key: TS-2902
>                 URL: https://issues.apache.org/jira/browse/TS-2902
>             Project: Traffic Server
>          Issue Type: Improvement
>            Reporter: Masakazu Kitajo
>            Assignee: Bryan Call
>              Labels: review
>             Fix For: 5.1.0
>
>         Attachments: make_it_configuarable.patch
>
>
> I get "*400* Content Length Required" when user agents send a POST request that doesn't contain any body data without a Content-Length header.
> (The header is omitted because the length is zero, I think)
> According to RFC2730 Section 3.3.2, presence of Content-Length is not MUST.
> http://tools.ietf.org/html/rfc7230#section-3.3.2
> {quote}
> 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.
> {quote}
> Also according to section 3.3.3,  a server are allowed to reject similar request with 411 Length Required, but not *400*.
> http://tools.ietf.org/html/rfc7230#section-3.3.2
> {quote}
>   A server MAY reject a request that contains a message body but not a
>    Content-Length by responding with 411 (Length Required).
> {quote}
> Traffic Server should accept the requests, no body data without Content-Length header, or reject it with *411*. I think the former one is better for interoperability.



--
This message was sent by Atlassian JIRA
(v6.2#6252)