The sever is now able to get any optional file descriptor that might
have been sent over with the bytes related to a request. This patch
leverages this ability by extending the Request structure with an
optional File, which might have been received from the byte stream.
With the Request containing an optional File, we give the consumers of
this crate the possibility to receive a file descriptor associated with
the HTTP request.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Allow the creation of the http server's socket from an existing
fd. This is done to enable another process to initiate the creation of
a server by preparing the socket so it can immediately be used rather
than polling to connect to the path.
Note, the coverage file change due to what appears to be a rounding
error when calculating coverage.
Signed-off-by: William Douglas <william.douglas@intel.com>
When we are not capable to provide a certain kind of service, but should be
after some delay. Http server is better to reply status code 503. It is more
suggestive per as to http spec.
```
The server is currently unable to handle the request due to a temporary
overload or scheduled maintenance, which will likely be alleviated after some delay.
```
Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
ErrorKind::Interrupted (libc::EINTR) errors should not break the
HttpServer requests loop, they are internally consumed and reported
as no events rather than requests errors.
Signed-off-by: Adrian Catangiu <acatan@amazon.com>
When doing IO with the underlying stream object, we should handle
the special case of ErrorKind::Interrupted, otherwise the connection
will be closed incorrectly.
Quotation from Rust doc:
An error of the [`ErrorKind::Interrupted`] kind is non-fatal and the
read operation should be retried if there is nothing else to do.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Route request according to {method, path} tuple, so we could use only
one router for each http server.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>