expect:100-continue is cool

2007-11-17 @ 11:56#

saw a great explanation of the use of the Expect HTTP Header from Dan Diephouse. here's the gist of his post

:
Expect: 100-continue. You can use the Expect header to ensure that the server will be willing to process the request. Sam brought up an example where you might be uploading a large image from a cellphone and you need to be authenticated to do so. You certainly don’t want upload the image and then get an unauthorized response! The solution to this is to have a client send an Expect: 100-continue header. After the client sends the headers it waits for the server to respond with either a “100 Continue” message or some other status like “401 Unauthorized”. Provided that the client gets a 100, it can continue sending the message. If it gets some other message, the connection is immediately closed and then the client can decide what to do next - like authenticate itself.

this gem comes from his post announcing his presentation at ApacheCon. i'll have to check that out, too!

code