Ethernet W5100 handling of xml files

PaulS:

A client post request might require the content length.

Also, when sending binary data, such as an image file, you must specify the content length.

That is an incorrrect assertion. Besides, if it were true - application/xml is also binary data.

Looking at the relevant specification:

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.

and the reason for this is also stated:

In HTTP, it SHOULD be sent whenever the message's length can be determined prior to being transferred,

or in other words, if content is being generated on the fly and buffering the entire content just to compute the length would be inconvenient (because, for example, your server is on a low-powered machine with little memory) then it is OK not to send it.

Its not ok, though, to just guess at a random value and send that :slight_smile: