Pergunta

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?

Foi útil?

Solução

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).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top