417 Expectation Failed

  • You are here: Free PHP » Uncategorized » 417 Expectation Failed

A server emits 417 Expecation Failed when it encountered a Expect header that it didn’t understand or doesn’t support.

A client can use the Expect header to tell the server that it requires a certain behavior from a server.

The only expectation that (as far as I know) is standardized, is 100-continue.

This looks like this:

POST /foo/bar HTTP/1.1
Content-Type: application/gzip
Content-Length: 12345678765
Expect: 100-continue

...

This request intends to upload a large file. The client tells the server that it expects the server to first respond with a 100 Continue response.

If a server supports this, it will first return this 100 Continue response, which tells a client that the request was understood, supported and probably acceptable and it can continue uploading.

If the server did not support this feature, it must response with 417:

HTTP/1.1 417 Expectation Failed
Content-Type: text/plain

We don't support 100-continue

If a server sees a different type of expectation that’s a new future standard, or some custom extension it should always return 417.

References

Powered by Gewgley