Open reschke opened 2 years ago
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?
See https://github.com/openjdk/jdk/pull/8017 and https://github.com/apache/httpcomponents-core/pull/360.
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).