Commit Graph

22 Commits

Author SHA1 Message Date
Luminita Voicu
eb8b8cb53d Add optional limit on request size
Signed-off-by: Luminita Voicu <lumivo@amazon.com>
2021-07-09 11:32:22 +03:00
Luminita Voicu
7f3a14f16f forbid GET requests with body content
Signed-off-by: Luminita Voicu <lumivo@amazon.com>
2021-07-09 11:32:22 +03:00
William Douglas
9b605a8b61 Enable creating a socket from an existing fd
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>
2021-04-20 11:15:44 +03:00
YUAN LYU
9e6ab4b5ab Clean up after cherry-picking commits from firecracker
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
George Pisaltu
e73f412536 micro-http: explicit HUP/ERR handling in server
The server in `micro_http` was not explicitly handling the `EPOLLHUP`,
`EPOLLRDHUP` and `EPOLLERR` epoll events. Added new checks that close
a connection that is signaled with these events.

Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
berciuliviu
ed44e2af6f Add error handling for fatal errors
This commit adds a mechanism that considers
some errors as 'fatal'. It alerts the user and then
terminates the Firecracker process.

Signed-off-by: berciuliviu <lberciu@amazon.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
Alexandru Cihodaru
683b85d07e Added support for Accept-Encoding
Signed-off-by: Alexandru Cihodaru <cihodar@amazon.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
cihodar
8a8d7bb5b1 Made InvalidHeader error more verbose.
Changed the way we handle TransferEncoding
and added new test cases.

Signed-off-by: cihodar <cihodar@amazon.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
Damien Stanton
eeae4ac11d Remove all extern crate...
In Rust 2018 edition, it is considered unidiomatic to use "extern crate"
sunthax. The proper way to do it is to replace extern crate with "use"
declarations.

- Also impl clippy suggestions for fn main removal in doctests
- Fix unneeded box allocations and clones

Signed-off-by: Damien Stanton <damien.stanton@gmail.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
Damien Stanton
a7f035b8c5 micro_http: switch to rust edition 2018
Signed-off-by: Damien Stanton <damien.stanton@gmail.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
defunct
48b8f179c8 use epoll implementation from vmm-sys-util
Signed-off-by: defunct <defunct@defunct.io>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
Ioana Chirca
17ead39d82 micro_http: check arithmetic operations
Signed-off-by: Ioana Chirca <chioana@amazon.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
timvisee
3e888638e5 Implement clippy suggestions for Rust 1.43.1
Signed-off-by: timvisee <tim@visee.me>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
Shion Yamashita
2e3f629054 micro_http: fix name of helper function in tests
Signed-off-by: Shion Yamashita <shioyama1118@gmail.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
Shion Yamashita
d7a7bd0fe2 Use TempFile when generating path to socket
Signed-off-by: Shion Yamashita <shioyama1118@gmail.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
Adrian Catangiu
d288940391 micro_http: gracefully handle EINTR
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>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
Laura Loghin
548d297be7 Completely remove epoll crate dependency
Move epoll.rs from polly to utils crate and use this file,
in micro_http, as an epoll wrapper instead of the epoll crate.

Signed-off-by: Laura Loghin <lauralg@amazon.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
karthik nedunchezhiyan
569230220f micro_http: some doc and code corrections
Signed-off-by: karthik nedunchezhiyan <karthik1705.n@gmail.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +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
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
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
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