Commit Graph

21 Commits

Author SHA1 Message Date
Egor Lazarchuk
5c2254d6cf chore: fix lifetime related warning
Specify a hidden lifetime to remove a warning message.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
2025-11-20 15:34:06 +00:00
Egor Lazarchuk
936b18fce6 chore: fix doc comments
Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
2025-11-04 10:32:15 +00:00
Patrick Roy
ef43cef716 chore: appease clippy
Fix clippy lints now triggered due to upgraded rust toolchain

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
2024-02-22 11:41:58 +00:00
Patrick Roy
43d5a1d4b0 Clear all clippy warnings
Additionally, HttpServer::new_from_fd has been marked as unsafe,
since the correctness of the unsafe call within the function
relies on the caller upholding an invariant

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
2022-11-22 12:15:22 +02:00
Sebastien Boeuf
a730d86940 Receive multiple file descriptors with a Request
Extending the existing code to support receiving more than one file
descriptor per request. The micro-http crate might be used in a context
where multiple file descriptors are associated with one request, hence
the need to update the micro-http crate.

A concrete example from Cloud Hypervisor is to be able to pass multiple
TAP file descriptors at once when adding a new network interface. This
way it can hotplug a multiqueue device.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-01-28 19:30:22 +02:00
Sebastien Boeuf
9517a30037 Retrieve the optional file associated with a Request
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>
2021-07-14 16:42:48 +03:00
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
Luminita Voicu
a5fdf928eb response: minor comment fixes
Signed-off-by: Luminita Voicu <lumivo@amazon.com>
2021-07-09 11:32:22 +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
Alexandra Iordache
88de0ed16b micro-http: unsigned Content-Length...
...and a bunch of fixes for unchecked unsigned arithmetic
in connection.rs. Added more unit tests too that exercise
failure cases for over/underflows in mathematic operations.

Fixes #1977

Signed-off-by: Alexandra Iordache <aghecen@amazon.com>
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
Popa
7eb11b44cb clean-up: get rid of misplaced cfg(test)
Signed-off-by: Popa <dpopa@amazon.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
2021-04-15 11:21:32 +03:00
keyangxie
7289d64e24 micro_http: update unit test
Add some test cases for uri test, to cover sub-domain uri
and `ip:port`.

Refactor `test_uri` and `test_find`. Leverage tupled vector
to init test inputs and expected values, and remove superfluous
lines. It will be more flexible to modify the test cases.

Signed-off-by: keyangxie <keyang.xie@gmail.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
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
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