Commit Graph

19 Commits

Author SHA1 Message Date
Adrian Catangiu
40309b72ee add .gitignore file
Signed-off-by: Adrian Catangiu <acatan@amazon.com>
2020-07-23 18:17:33 +03:00
Adrian Catangiu
c33861a13b Handle ErrorKind::Interrupted when waiting for events
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>
2020-07-23 18:17:33 +03:00
Liu Jiang
c9ffb90aeb Handle ErrorKind::Interrupted when doing stream IO
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>
2020-04-27 09:41:16 +03:00
Liu Jiang
0d87a94c8e Route request according to {method, path} tuple
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>
2020-03-30 13:52:34 +03:00
Liu Jiang
8ca0839b58 Simplify the HttpRoute trait
Previously the HttpRoute has logic to clone the handler parameter,
which is an implementation detail of the API server. So simplify
the HttpRoute interfaces by removing the argument cloning logic.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2020-03-30 13:52:34 +03:00
Liu Jiang
ac3bb940ab Import http routes from Cloud Hypervisor project
Import vmm/src/api/http.rs from Cloud Hyerpvisor project, commit
345c922cb9a88183e2da9d29230ecb945b0a6452 with following changes:
1) use generic type for handler argument.
2) remove server thread relative code.
3) add unit test cases.
4) refine for better code reuse.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2020-03-30 13:52:34 +03:00
Liu Jiang
31bc6268c7 Unregister fd from epoll_fd when closing a connection
When closing a http connection, the corresponding file descriptor
should be unregistered from the epoll fd.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2020-03-30 13:52:34 +03:00
Liu Jiang
3832d38d8c Reject negative content length in http header
It's almost an illegal input for a Content-Length header with negative
value, so reject it. Otherwise it may cause unexpected behavor when
parsing/receiving http requests.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2020-03-30 13:52:34 +03:00
Liu Jiang
aefdd1be46 Refine documentation according to latest code
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2020-03-30 13:52:34 +03:00
Liu Jiang
fbb4d5392a Refine code for rust edition 2018
Refine code to support rust edition 2018, no functional changes.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2020-03-30 13:52:34 +03:00
Andreea Florescu
e89ed14707 added readme file
The readme is still WIP, but it was added so that we can have links
to the other documents in the repository.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
2020-03-24 18:22:44 +02:00
Andreea Florescu
460020a10f added security policy document
This is adapted from firecracker's security policy document.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
2020-03-24 18:22:44 +02:00
Andreea Florescu
0f741b9d2b added a basic changelog file
Signed-off-by: Andreea Florescu <fandree@amazon.com>
2020-03-24 18:22:44 +02:00
Andreea Florescu
e8c0f8eaf0 added license
Signed-off-by: Andreea Florescu <fandree@amazon.com>
2020-03-24 18:22:44 +02:00
Andreea Florescu
da92575813 added contribution guidelines
The contribution guidelines are adapted from the firecracker
repository.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
2020-03-24 18:22:44 +02:00
Andreea Florescu
ac31e5745f added github issue template
Adjusted the github issue template from Firecracker.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
2020-03-24 18:22:44 +02:00
Andreea Florescu
e712d6ae23 fix link issues on aarch64 musl
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang-nursery/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
2020-01-30 15:21:04 +02:00
Andreea Florescu
fc538a8ba0 Added Buildkite CI
It's easier to test this with the rust-vmm-ci directly as it already
runs all the basic tests.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
2020-01-30 15:21:04 +02:00
Andreea Florescu
6708271862 initial commit
Pulled the code from firecracker-microvm/src/micro-http.

Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: Andreea Florescu <fandree@amazon.com>
2020-01-27 12:28:50 +02:00