<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Nov 17, 2012, at 0:58 , Joe Shaw wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<div><br></div><div>I have a web app that accepts uploads from clients.  We have a relatively high client_max_body_size set, and I'd like for clients to be able to be quickly rejected if they intend to upload files larger than the max body size.  The "Expect: 100-continue" header seems ideally suited for this.</div>
<div><br></div><div>However, when I try to upload a large file with curl (which uses the Expect header), nginx responds with "100 Continue" instead of "413 Request Entity Too Large":</div><div><br></div>
<div><div>> POST /test HTTP/1.1</div><div>> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5</div><div>> Host: <a href="http://example.com/">example.com</a></div><div>> Accept: */*</div>
<div>> Content-Length: 454327718</div><div>> Content-Type: application/octet-stream</div><div>> Expect: 100-continue</div><div>> </div><div>< HTTP/1.1 100 Continue</div><div>< HTTP/1.1 413 Request Entity Too Large</div>
<div>< Server: nginx/1.2.0</div><div>< Content-Type: text/html; charset=utf-8</div><div>< Date: Fri, 16 Nov 2012 20:40:24 GMT</div><div>< Connection: Keep-Alive</div><div>< Content-Length: 198</div></div><div>
<br></div><div>I would have expected nginx to return the 413 error instead of the 100 status code.  As it is now, the client will continue to upload its data because it got the go ahead via the 100 status code.</div><div>
<br></div><div>Is this a bug (or unimplemented feature) in nginx?  Is there any way around this?  As you can see from the response, I'm using nginx 1.2.0, which I realize isn't the latest, but I couldn't find anything related to this in the CHANGES file.</div>
</blockquote></div><div><br></div>The attached patch should fix the bug.<div><br></div><div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><br class="Apple-interchange-newline">--<br>Igor Sysoev<br></span></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><a href="http://nginx.com/support.html">http://nginx.com/support.html</a></span></div></span></span>
</div>
<br></div><div></div></body></html>