cli icon indicating copy to clipboard operation
cli copied to clipboard

The content of a response is not return on 413

Open kevinsimper opened this issue 8 years ago • 5 comments

When trying to post through Google Load Balancer I get this error and the response it not returned from the Nginx but the curl version works.

$ http -f POST XXX \
> variables='XXXX' \
> file@./testfile.dat
http: error: ConnectionError: ('Connection aborted.', BrokenPipeError(32, 'Broken pipe')) while doing POST request to URL: XXXX
$ curl -v XXXX \
> -H "Content-Type:multipart/form-data" \
> -F XXXX
> -F 'file=@./testfile.dat'
*   Trying XXXX...
* TCP_NODELAY set
* Connected to XXXX (XXXX) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: XXX
* Server certificate: RapidSSL SHA256 CA
* Server certificate: GeoTrust Global CA
> POST /api/graphql HTTP/1.1
> Host: XXX
> User-Agent: curl/7.51.0
> Accept: */*
> Content-Length: 104858299
> Expect: 100-continue
> Content-Type:multipart/form-data; boundary=------------------------200e4faa1c52a317
>
< HTTP/1.1 413 Request Entity Too Large
< Server: nginx/1.13.3
< Date: Wed, 09 Aug 2017 12:12:02 GMT
< Content-Type: text/html
< Content-Length: 199
< Strict-Transport-Security: max-age=15724800; includeSubDomains;
< Via: 1.1 google
< Alt-Svc: clear
< Connection: close
<
<html>
<head><title>413 Request Entity Too Large</title></head>
<body bgcolor="white">
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.13.3</center>
</body>
</html>
* Curl_http_done: called premature == 0
* Closing connection 0

kevinsimper avatar Aug 09 '17 12:08 kevinsimper

Is there a URL this would be possible to test on?

jkbrzt avatar Sep 05 '17 23:09 jkbrzt

@jakubroztocil I think you could test with any url that will throw a request too large :)

kevinsimper avatar Sep 10 '17 10:09 kevinsimper

HTTPie doesn't have any special handling for 413 Request Entity Too Large so the general case is handled correctly:

$ http POST https://httpstat.us/413
HTTP/1.1 413 Request Entry Too Large
Access-Control-Allow-Origin: *
Cache-Control: private
Content-Length: 27
Content-Type: text/plain; charset=utf-8
Date: Sun, 10 Sep 2017 10:55:53 GMT
Server: Microsoft-IIS/8.0
Set-Cookie: ARRAffinity=f7ec225ea3ba12b5d96938c2065ab92c03595a86442e4084a5d51f2e948569ac;Path=/;HttpOnly;Domain=httpstat.us
X-AspNet-Version: 4.0.30319
X-AspNetMvc-Version: 5.1
X-Powered-By: ASP.NET

413 Request Entry Too Large

jkbrzt avatar Sep 10 '17 11:09 jkbrzt

opps.... @kevinsimper. i meant to post this somewhere else. :P

redalert11 avatar Sep 01 '18 15:09 redalert11

@jakubroztocil It kind of have, since Connection aborted is showed from httpie and not from curl. @redalert11 It is not nginx that is the problem, it is that curl shows the correct output and httpie doesn't with the same input :)

kevinsimper avatar Sep 01 '18 20:09 kevinsimper