Bamboo Agent upload of artifacts fails to set Content-Length:, causes problems when using a proxy that implements strict HTTP/1.1
Our preferred reverse proxy solution is Lighttpd. However, use of Lighttpd resulted in failure of Bamboo Agents to upload artifacts to the Bamboo Server.
Upon investigation, we discovered the following error in the Lighttpd error logs:
2010-01-08 13:50:26: (request.c.1115) POST-request, but content-length missing -> 411
HTTP/1.1 - http://www.ietf.org/rfc/rfc2616.txt - Section 4.4:
...
For compatibility with HTTP/1.0 applications, HTTP/1.1 requests
containing a message-body MUST include a valid Content-Length header
field unless the server is known to be HTTP/1.1 compliant. If a
request contains a message-body and a Content-Length is not given,
the server SHOULD respond with 400 (bad request) if it cannot
determine the length of the message, or with 411 (length required) if
it wishes to insist on receiving a valid Content-Length.
And below in section 10.4.12:
10.4.12 411 Length Required
The server refuses to accept the request without a defined Content-
Length. 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.
And further below in section :
14.13 Content-Length
The Content-Length entity-header field indicates the size of the
entity-body, in decimal number of OCTETs, sent to the recipient or,
in the case of the HEAD method, the size of the entity-body that
would have been sent had the request been a GET.
Content-Length = "Content-Length" ":" 1*DIGIT
An example is
Content-Length: 3495
Applications SHOULD use this field to indicate the transfer-length of
the message-body, unless this is prohibited by the rules in section
4.4.
Any Content-Length greater than or equal to zero is a valid value.
Section 4.4 describes how to determine the length of a message-body
if a Content-Length is not given.
Note that the meaning of this field is significantly different from
the corresponding definition in MIME, where it is an optional field
used within the "message/external-body" content-type. In HTTP, it
SHOULD be sent whenever the message's length can be determined prior
to being transferred, unless this is prohibited by the rules in
section 4.4.
According to my research, both Microsoft IIS and Lighttpd are strict on this. I have confirmed that Lighttpd does not have a configuration option to disable this level of strictness. Apache, however, is lax about enforcing this rule. As a result, Apache works and Lighttpd fails.
Please correct the Bamboo Agent upload of artifacts to specify a Content-Length according to the specification defined above so we can switch back to Lighttpd.