You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user agent SHOULD send Content-Length in a request when the method defines a meaning for enclosed content and it is not sending Transfer-Encoding. For example, a user agent normally sends Content-Length in a POST request even when the value is 0 (indicating empty content). A user agent SHOULD NOT send a Content-Length header field when the request message does not contain content and the method semantics do not anticipate such data.
I don't see how a sender can implement the "SHOULD NOT" correctly unless it happens to know the semantics of the method (which may not be the case for newly introduced methods).
The text was updated successfully, but these errors were encountered:
A user agent is expected to understand the semantics of any method it chooses to use, even if it is acting on downloaded instructions (e.g., javascript).
But what does this mean, for instance, for an HTTP client library? How is it supposed to know? Are you saying that the program that uses the library needs to tell the library?
The person programming the library has to know and incorporate that into the code or calling parameters that implement a request and process the response. IOW, they deliberately choose to send content (or not) and the client has to send the correct header fields for that choice. The UA is the code calling the HTTP client library. A client library that allows arbitrary method construction just needs to know the difference (provide an API that distinguishes) between "no content" and "content of length 0". E.g., null versus empty string.
https://httpwg.org/specs/rfc9110.html#field.content-length has:
I don't see how a sender can implement the "SHOULD NOT" correctly unless it happens to know the semantics of the method (which may not be the case for newly introduced methods).
The text was updated successfully, but these errors were encountered: