aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-dirclient/src/util.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* dirclient: Split EncodedRequest and RequestBody.Nick Mathewson2026-05-121-6/+9
| | | | | RequestBody is now just an `Option<Arc<str>>` internally, and EncodedRequest is much simpler.
* tor-dirclient: Avoid copying bytes that we want to POST.Nick Mathewson2026-05-121-11/+20
| | | | | This required a change to the hsservice tests, which previously assumed that we'd perform one write per request.
* tor-dirclient: Introduce a new RequestBody type.Nick Mathewson2026-05-121-4/+12
| | | | | I'm going to use this to avoid copying when uploading large documents.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* arti, cell, dirclient: Use expect instead of unwrap.Nick Mathewson2025-05-291-1/+1
| | | | | | Clippy nightly detects this problem, though earlier clippy verisons haven't. The common element here is applying unwrap() to the result from a write!().
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Only send Content-Length when needed.Nick Mathewson2023-11-271-12/+9
| | | | | | | | | | | | | | | According to RFC 9110: A user agent SHOULD send Content-Length in a request when the method defines a meaning for enclosed content and it is not sending Transfer-Encoding. For example, a user agent normally sends Content-Length in a POST request even when the value is 0 (indicating empty content). A user agent SHOULD NOT send a Content-Length header field when the request message does not contain content and the method semantics do not anticipate such data. Part of #1024
* tor-dirclient, tor-netdoc: Add TODO SPECs.Gabriela Moldovan2023-10-241-0/+1
|
* tor-dirclient: Always set the Content-Length header (fmt).Gabriela Moldovan2023-10-241-1/+4
|
* tor-dirclient: Always set the Content-Length header.Gabriela Moldovan2023-10-241-12/+5
|
* tor-dirclient: Add a Content-Length header (fmt).Gabriela Moldovan2023-10-241-1/+3
|
* tor-dirclient: Add a Content-Length header.Gabriela Moldovan2023-10-241-2/+16
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* tor-dirclient: Fix clippy lints.Gabriela Moldovan2023-08-161-5/+5
|
* tor-dirclient: Make Requestable return requests with String bodies.Gabriela Moldovan2023-08-161-20/+9
| | | | | It's simpler to always use a `String` to represent directory request bodies. We no longer need the `StringBody` trait.
* tor-dirclient: Rename StringBody::str() to StringBody::as_str().Gabriela Moldovan2023-08-161-2/+2
|
* tor-dirclient: Extend format test to check the body is formatted too (fmt)Gabriela Moldovan2023-08-161-1/+4
|
* tor-dirclient: Extend format test to check the body is formatted too.Gabriela Moldovan2023-08-161-8/+22
|
* tor-dirclient: Move request building to a test helper function.Gabriela Moldovan2023-08-161-11/+13
|
* tor-dirclient: Make the body type of a `Requestable` type configurable.Gabriela Moldovan2023-08-161-2/+4
| | | | | | | | | Previously, the `Requestable` trait assumed the body of the request would always be empty (`http::Request<()>`). This change replaces the hardcoded `()` body type with the `Requestable::Body` associated type (which will allow implementors to create requests with non-empty bodies). This will enable us to reuse the `Requestable` trait for building `POST` requests for uploading descriptors.
* tor-dirclient: Rename download() to send_request().Gabriela Moldovan2023-08-161-0/+1
| | | | | | `download()` is actually a general-purpose function for sending HTTP requests on a stream. We will soon repurpose it for `POST`-ing descriptors, so let's rename it to `send_request`.
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* clippy: Use write! rather than push_str, formatIan Jackson2022-05-111-2/+6
| | | | | This does involve unwrap, but of course that can't fail unless the formats fail, which would already panic (that's implied by format!).
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+42
This will cause some pain for now, but now is really the best time to do this kind of thing.