Upon receiving a request which includes an Expect request-header
field with the "100-continue" expectation, an origin server MUST
either respond with 100 (Continue) status and continue to read
from the input stream, or respond with a final status code. The
origin server MUST NOT wait for the request body before sending
the 100 (Continue) response. If it responds with a final status
code, it MAY close the transport connection or it MAY continue
to read and discard the rest of the request. It MUST NOT
perform the requested method if it returns a final status code.
Currently, spray-can does not do this, and it causes several clients to misbehave. For example, libcurl (and curl) add the Expect: 100-continue header to every outgoing request with a request body. This causes libcurl based apps to pause before sending the body of the request.
The simple, naive solution would be to have spray-can immediately send a 100 Continue response immediately after reading in a request that contains the Expect header mentioned above. The intent of the behavior described above is for servers to fail fast on requests that they know they can't process (for example, ones to an invalid path/route) before the client sends a potentially large request body on. I suspect the simple solution is really the only way to go for a container like spray unless some elegant way of querying an HttpService actor about it's ability to handle a certain path before 'really' processing the request can be done.
According to the HTTP spec
Upon receiving a request which includes an Expect request-header field with the "100-continue" expectation, an origin server MUST either respond with 100 (Continue) status and continue to read from the input stream, or respond with a final status code. The origin server MUST NOT wait for the request body before sending the 100 (Continue) response. If it responds with a final status code, it MAY close the transport connection or it MAY continue to read and discard the rest of the request. It MUST NOT perform the requested method if it returns a final status code.
Currently, spray-can does not do this, and it causes several clients to misbehave. For example, libcurl (and curl) add the Expect: 100-continue header to every outgoing request with a request body. This causes libcurl based apps to pause before sending the body of the request.
The simple, naive solution would be to have spray-can immediately send a 100 Continue response immediately after reading in a request that contains the Expect header mentioned above. The intent of the behavior described above is for servers to fail fast on requests that they know they can't process (for example, ones to an invalid path/route) before the client sends a potentially large request body on. I suspect the simple solution is really the only way to go for a container like spray unless some elegant way of querying an HttpService actor about it's ability to handle a certain path before 'really' processing the request can be done.