ibnesayeed/webserver-tester

cs531a5: test_put_success_auth_diges

Closed this issue · 3 comments

[Link to RFC] (https://tools.ietf.org/html/rfc7231#section-4.3.3)

An origin server MUST NOT send a validator header field
(Section 7.2), such as an ETag or Last-Modified field, in a
successful response to PUT unless the request's representation data
was saved without any transformation applied to the body
(i.e., the
resource's new representation data is identical to the representation
data received in the PUT request) and the validator field value
reflects the new representation. This requirement allows a user
agent to know when the representation body it has in memory remains
current as a result of the PUT, thus not in need of being retrieved
again from the origin server, and that the new validator(s) received
in the response can be used for future conditional requests in order
to prevent accidental overwrites (Section 5.2).

I have copied a para from RFC, where it says Etag and Last Modified is not allowed in response for PUT.

Could you validate it?

I heave read the RFC before adding that assertion, though, I am not sure if @phonedude would require this check to be in place. However, to answer your question, read this part of your quote:

... unless the request's representation data was saved without any transformation applied to the body

for PUTs, we're returning 201s, with message bodies like "the file foobar.txt was successfully sent", so thus there would be no ETag or L-M.

Oh, I thought the actual file was echoed back (which is a common practice).

@phonedude are we expecting chunked encoded text/html response? If so, I can add assertions accordingly.