Doctests in `lib.rs` and `server.rs` were both using the same hardcoded
socket path `/tmp/example.sock`. When running tests in parallel, this
caused conflicts and sporadic failures with `AddrInUse`.
Fix this by using unique socket paths for each doctest.
Assisted-by: Antigravity:Gemini-3.5-Flash
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
Add a Conflict variant to the StatusCode enum so that responses can
report the 409 status code, and map it to its raw representation.
Signed-off-by: Stepan Rabotkin <epicstyt@gmail.com>
Add a Delete variant to the Method enum to support DELETE requests.
Reject DELETE requests with a body (same as GET requests).
Signed-off-by: Ilias Stamatis <ilstam@amazon.com>
EC2 IMDS includes X-Aws-Ec2-Metadata-Token-Ttl-Seconds header in the
response to PUT /latest/api/token. To enable Firecracker MMDS to behave
compatibly with EC2 IMDS, allow to set custom headers in HTTP response.
Signed-off-by: Takahiro Itazuri <itazur@amazon.com>
The addition of the "TooManyRequests" status code is in order to notify
users when an operation is still pending, and this seems to be the best
fit we can have for now.
On the Cloud Hypervisor side we'll use it, for instance, for the case
when a caller tries to offline a vCPU but the previous offline operation
is still pending, leaving at least a chance for the caller to analyse
the error and decide whether they want to retry the operation or not.
TooManyRequests: https://datatracker.ietf.org/doc/html/rfc6585#section-4
Signed-off-by: Fabiano Fidêncio <fidencio@northflank.com>
The client may wait for the server to close the connection or for
timeout to occur in some cases. This commit changes it to always set
Content-Length field in non-100/204 responses regardless of whether
the body is empty. Although it doesn't cover all the patterns where
the response must not set it, users can remove it by calling
`set_content_length(None)`.
Signed-off-by: Takahiro Itazuri <itazur@amazon.com>
The update brings a fix for a security vulnerability behind
feature-gated code not used by micro-http (the `with-serde` feature),
see GHSA-875g-mfp6-g7f9
Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Added shutdown event-fd acting as a kill switch actionable from
outside the micro-http server.
Needed to be able to break out of the inner epoll_wait on demand.
This can be used to signal the micro-http server running on a
dedicated thread that it needs to shut down.
Co-authored-by: acatangiu <adrian.catangiu@gmail.com>
Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
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>
7af2e16 add support for specifying the agent queue
e2e2918 generate pipeline: support for FW unknown keys
b0edd17 autogenerate_pipeline: use dictionary instead of self
edd221a don't allow undocumented unsafe blocks
5f36cc9 fix whitespace problems in autogenerate script
2eab275 allow the timeout to be overwritten in input
1401bad fix test benchmark
258161e update README with latest version
6fbd7c7 fix test commit format
b3ed1c9 update to container version 16
99fe2eb Relax 50/72 rule for more descriptive titles
ee6be8c make coverage test less sensitive to changes
d216a46 Update to rustvmm/dev:v15 with Rust 1.58.1
d023262 Use v14 container image with Rust 1.54
b6858b2 run `cargo audit` with `--deny warnings` enabled
aee82cf Add @gsserge to CODEOWNERS
b037be3 update test_coverage to allow running it on crates
7931077 Assert no spaces in crate features JSON
68d4dbf Check formatting of code examples in doc comments
7f22582 update container version to v13
ce13bfb Make build warnings fatal, again
472dea0 Document default timeout for pipeline step
f67ef4c Update README.md
dd754bb Add timeout for Buildkite steps
e58c6f6 Remove static pipeline
6e1bdaa Make build warnings fatal
ae7db2d Rename master to main
1311bfa Update clippy test command
d7ca3dc Add help option for scripts
8901e77 Leftovers from #79
555474a Add script to run tests locally
cd3d97f Allow skipping tests when generating the pipeline
cc6ed99 Format integration tests code
ba2f45c make the test description configurable
877d1fb Update README.md
b47488a Autogenerate pipeline fron json config file
a00c7d2 Update the pipeline steps that run the tests
0b9d283 Create local rust crate and update config path
7693628 Update commit format test to work locally
d2ab3c0 use the latest docker plugin version
9f7b0d9 check commit authors for each commit
6591890 use rust-vmm-container v12
24d66cd update clippy check
ebc7016 exclude dependabot from the 50/72 commit rule
63fdf0f update rust-vmm-container
98a26fe Typo fix in README.md
631c82a mount tmp in test pipelines
03fcf08 don't run commit test for repos specified with git
3b7377c fixed typo in readme
c9430ee add gitignore file
e1108f1 buildkite: re-enable cargo audit test
02004b5 Add a flag that saves the coverage output dir
97025bd buildkite: Skip lines should be shorter than 70 chars
c83003c buildkite: Skip cargo audit check temporarily
c8cf2b7 buildkite: Fix audit label indentation
b3acb30 Fixes: https://github.com/rust-vmm/rust-vmm-ci/issues/8
bedc32b Add --workspace flag to cargo check too
3ea5f2b improve a bit error messages for commit test
cd90a63 Add support for workspace tests
9dd386c readme update: cosmetic changes
265df53 Coverage test: keep stdin open
2d3bb05 add myself to codeowners
e58ea74 Fix kcov_ouput_dir typo in test_coverage.py
d62d781 fix buildkite typos in readme
0fc8ced refactor test_benchmark.py
741b894 checkout to PR branch before finishing test_bench
645a5c3 test_bench: don't crash when no bench on master
bd32544 Fetch origin in benchmark test
35beb91 Fix commit message test
53427aa benchmarks: add test that can run at every PR
abd2c90 Add test for commit message format
fe859f4 Update container image to v6
75d7254 run cargo check on all features
7e3f307 skip coverage-arm test
cd7096e Enable rust-vmm coverage test in CI
Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Added `build.rs` to produce a compile error when attempting to build on a
non-Unix-like system, and clarified support in `readme.md`.
Signed-off-by: Jonathan Woollett-Light <jcawl@amazon.co.uk>
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>
This commit adds support for the `Deprecation` HTTP header based on
https://tools.ietf.org/id/draft-dalal-deprecation-header-03.html .
Users can set this header in a `Response` to send a
"Deprecation: true" header field back to the requester, signaling
that the resource accessed has been deprecated.
Signed-off-by: George Pisaltu <gpl@amazon.com>
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>
The stream used by the Connection structure is expected to implement
both Read and Write traits. Since we want the server to be able to
receive file descriptors through control messages mechanism, this patch
extends the expectations regarding the stream by adding ScmSocket to the
list of traits.
Since the stream is a UnixStream structure, and since vmm-sys-util
already provides an ScmSocket implementation for UnixStream, extending
the list of traits is very straightforward.
Relying on the newly added trait, the server now reads incoming bytes
through recv_with_fd() function, which replaces the former call to
read(). This change has no intent of modifying the former behavior from
the read(), which is why the returned Option<File> is ignored for now.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>