문제

RFC2616 Sec 14 "14.26 If-None-Match"

The meaning of "If-None-Match: *" is that the method MUST NOT be performed if the representation selected by the origin server ... exists, and SHOULD be performed if the representation does not exist. This feature is intended to be useful in preventing races between PUT operations.

I don't understand how this feature can prevent race conditions. Is this any different than simply omitting the "If-Match" header?

도움이 되었습니까?

해결책

Imagine your client thinks a resource is not existing at the server and wants to put only one resource in this case on the server.

If two such clients are operating they both might think the resource doesn't exist and perform their puts concurrently. Without the If-None-Match: * header they both do the PUT request. With this header one client will fail (seeing a 304 - Not Modified).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top