aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-dirclient/src/response.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: Add accessor for status message.Nick Mathewson2026-05-121-0/+5
|
* Rename DirResponse::from_body to from_get_bodyClara Engler2026-03-041-1/+1
| | | | | | This reflects that it is expected for an HTTP GET body. It is okay because it is only used in tor-dirmgr, which only performs GET request anyways.
* tor-dirclient: Only fail on empty GET responsesClara Engler2026-03-041-7/+12
| | | | | | | | | This commit fixes the previous check to only fail on empty GET responses. For this, it introduces a `method` field into `DirResponse`, which is required to determine the method there. Doing this is reasonable for an HTTP client, as responses have different meanings depending on the request method used.
* tor-dirclient: Disallow empty successful responsesClara Engler2026-03-041-0/+9
| | | | | | | | | | | | | | | This commit disallows empty responses with a status code 200. From a pure HTTP level, this is totally valid, but it does not make any sense in the context of the Tor directory protocol, where an empty response only makes sense with a 404. The motivation for this is that a work-in-progress tor_dirclient::send_request wrapper for tor-dirserver passes the response into the parse2 multiple function which returns a Vec<T>. Interfacing code would then always have to check for an empty length and do respective error handling, which should already fail at an earlier level (tor-dirclient) instead.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* dirclient: Use the new Tunnel interface (fmt).Gabriela Moldovan2025-08-051-1/+3
|
* dirclient: Use the new Tunnel interfaceDavid Goulet2025-08-051-9/+10
| | | | | | This entirely removes the requirement on ClientCirc. Signed-off-by: David Goulet <[email protected]>
* Rename last_hop to last_hop_info to fix name conflictNick Mathewson2025-07-101-3/+3
|
* dirclient: Make SourceInfo::from_circuit public.Nick Mathewson2025-07-101-8/+8
|
* dirclient: refactor logic for constructing a SourceInfo from a circuitNick Mathewson2025-07-101-5/+11
| | | | | | | 1) It's the last hop that matters, not the first. 2) The last hop could conceivably be virtual, making the source anonymous. (Though this never happens in Arti today.)
* tor-proto: Update the TunnelMutableState when a circuit is removed.Gabriela Moldovan2025-05-151-4/+4
| | | | | | | | This is messy, because `ClientCirc::{path_ref, n_hops, ..}` become fallible (we can't unwrap the result, because when a circuit is closed, its state gets removed from the `TunnelSharedState`, but its `ClientCirc` handle continues to exist, so any attempt to retrieve the state will result in an `Err`).
* Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-251-1/+1
| | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Preserve HTTP status text in dirclient errors.Nick Mathewson2023-11-291-4/+13
| | | | | | | | The HTTP status text is often useful for diagnosing errors. Tor directory and hsdir caches frequently put useful messages there, especially when rejecting an uploaded document. Inspired by #1142.
* tor-dirclient: Mark `DirResponse` as `#[must_use]`.Gabriela Moldovan2023-10-031-0/+1
| | | | | Not checking whether the response is successful can have unintended consequences.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* 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.
* tor-dirclient: Replace OwnedChanTarget with LoggedChanTarget in SourceInfoIan Jackson2022-11-231-4/+4
| | | | | | | | | | | | | | | | SourceInfo primarily appears in errors, here and in (indirectly) tor-dirmgr. This 1. Makes the errors smaller 2. Redacts (currently, scrubs) the chantarget when safe logging is enabled This commit therefore deals with both tor-dirmgr and tor-dirclient errors, from the pov of error information that should become sensitive as part of bridge support. The error pyaloads directly in tor_dirmgr/src/err.rs don't seem to contain anything in that category.
* tor-dirclient: Response: Provide into_output_stringIan Jackson2022-11-031-0/+11
| | | | | This is the missing one of the full set. It turns out that I wanted this rather than the non-consuming output_string.
* tor-dirclient::DirResponse: provide output_stringIan Jackson2022-10-251-0/+17
| | | | This gives callers a nice error type with source and everything.
* tor-dirclient: Provide fallible DirResponse::output and into_outputIan Jackson2022-10-201-1/+80
|
* tor-dirclient: Make DirResponse be CloneIan Jackson2022-10-201-1/+1
| | | | I want this for testing. It seems friendly to provide it, though.
* tor-dirclient Response: Rename output methodsIan Jackson2022-10-201-2/+6
| | | | | These don't check errors and are therefore quite hazardous. I'm going to introduce a more cooked version in a moment.
* Improve display for tor-dircache errors.Nick Mathewson2022-07-071-1/+1
| | | | | | | These errors no longer use Debug to dump the `Option<SourceInfo>`, but instead produce reasonable text. Also, I've fixed the SourceInfo Display implementation so that it now says that it got the error "from $source via $circuit" rather than the other way around.
* Fix a portability issue with Rust 1.56Nick Mathewson2022-05-161-1/+1
|
* DirMgr: Improve display for DocSourceNick Mathewson2022-05-161-1/+2
| | | | (Also, implement Display for tor_dirclient::SourceInfo).
* dirclient: Collect and expose peer information from errors.Nick Mathewson2022-03-211-4/+4
| | | | | | | | | | This commit refactors the dirclient error type into two cases: errors when constructing a circuit, and errors that occur once we already have a one-hop circuit. The latter can usually be attributed to the specific cache we're talking to. This commit also adds a function to expose the information about which directory gave us the info.
* dirclient: Remember the source of each resposne we receive.Nick Mathewson2022-03-211-6/+15
|
* Tests for tor-dirmgr::bootstrapNick Mathewson2021-11-111-0/+5
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+91
This will cause some pain for now, but now is really the best time to do this kind of thing.