-
Bug
-
Resolution: Fixed
-
Normal
-
None
-
None
-
None
I'm currently playing around with the MusicBrainz Webservice v2 and it seems as if the endpoint would have problems accepting HTTP 1.1 chunked requests. Chunked requests are used when the client does not know the length of the request before it starts transmitting the request to the server. It therefore leaves out the "Content-Length" header and instead specifies "Transfer-Encoding: chunked". More information can be found here: http://en.wikipedia.org/wiki/Chunked_transfer_encoding
The client library I use (the Java library Apache HttpClient as a backend of the JAX-RS implementation Jersey) seems to use chunked encoding by default. My requests therefore get rejected with error code 411, Length required. This seems to be a problem with old versions of nginx, which only seems to support these kinds of requests since v1.3.9 (released 27 Nov 2012). For older versions, there is a module available: http://wiki.nginx.org/NginxHttpChunkinModule
To reproduce the problem, please try the following (chunked encoding enabled):
curl -v -X POST --header "Transfer-Encoding: chunked" -d "<xml />" "http://musicbrainz.org/ws/2/recording" * About to connect() to musicbrainz.org port 80 (#0) * Trying 72.29.166.157... * Adding handle: conn: 0x7fce7c007200 * Adding handle: send: 0 * Adding handle: recv: 0 * Curl_addHandleToPipeline: length: 1 * - Conn 0 (0x7fce7c007200) send_pipe: 1, recv_pipe: 0 * Connected to musicbrainz.org (72.29.166.157) port 80 (#0) > POST /ws/2/recording HTTP/1.1 > User-Agent: curl/7.31.0 > Host: musicbrainz.org > Accept: */* > Transfer-Encoding: chunked > Content-Type: application/x-www-form-urlencoded > > 7 * upload completely sent off: 14 out of 7 bytes < HTTP/1.1 411 Length Required * Server nginx/0.7.65 is not blacklisted < Server: nginx/0.7.65 < Date: Fri, 09 Aug 2013 02:48:45 GMT < Content-Type: text/html < Content-Length: 181 < Connection: close < <html> <head><title>411 Length Required</title></head> <body bgcolor="white"> <center><h1>411 Length Required</h1></center> <hr><center>nginx/0.7.65</center> </body> </html> * Closing connection 0
vs. (chunked encoding disabled):
curl -v -X POST -d "<xml />" "http://musicbrainz.org/ws/2/recording" * About to connect() to musicbrainz.org port 80 (#0) * Trying 72.29.166.157... * Adding handle: conn: 0x7fc800807200 * Adding handle: send: 0 * Adding handle: recv: 0 * Curl_addHandleToPipeline: length: 1 * - Conn 0 (0x7fc800807200) send_pipe: 1, recv_pipe: 0 * Connected to musicbrainz.org (72.29.166.157) port 80 (#0) > POST /ws/2/recording HTTP/1.1 > User-Agent: curl/7.31.0 > Host: musicbrainz.org > Accept: */* > Content-Length: 7 > Content-Type: application/x-www-form-urlencoded > * upload completely sent off: 7 out of 7 bytes < HTTP/1.1 401 Unauthorized < Date: Fri, 09 Aug 2013 02:49:58 GMT < Content-Type: text/plain; charset=UTF-8 < Connection: keep-alive < Keep-Alive: timeout=20 * Server nginx/0.7.65 is not blacklisted < Server: nginx/0.7.65 < ETag: "38022f9d088139841bfca8eb4429d3cd" < WWW-Authenticate: Digest realm="musicbrainz.org", qop="auth,auth-int", nonce="TJrzYJ4A4xGyCGCPotnoXw==", opaque="TkH1YJ4A4xGyCGCPotnoXw==", algorithm="MD5" < WWW-Authenticate: Bearer realm="musicbrainz.org" < WWW-Authenticate: MAC realm="musicbrainz.org" < Content-Length: 23 < Access-Control-Allow-Origin: * < * Connection #0 to host musicbrainz.org left intact
- is resolved by
-
MBH-343 Upgrade to latest nginx at load balancers
- Closed