Skip to content

Refactor rttp client#1

Merged
fewensa merged 27 commits intomainfrom
refactor
Mar 14, 2026
Merged

Refactor rttp client#1
fewensa merged 27 commits intomainfrom
refactor

Conversation

@fewensa
Copy link
Copy Markdown
Owner

@fewensa fewensa commented Nov 26, 2021

This version will migrate use socket2

fewensa and others added 18 commits November 26, 2021 23:55
…, and CI (#7)

* Update features and CI for socket2 migration

* Fix rustls feature list

* Bump checkout action to v6

* Fix CI branch and relax dependency specs
… Alphanumeric type (#9)

- connection/mod.rs: remove incorrect #[cfg(feature = "async")] guard on block_connection
- connection/connection.rs: replace socket.into_tcp_stream() with std::net::TcpStream::from(socket)
- connection/connection.rs: implement missing ServerCertVerifier methods and #[derive(Debug)] for NoCertificateVerification
- connection/connection.rs: call .to_owned() on ServerName to fix lifetime issue
- connection/connection.rs: use Display instead of Debug for native-tls HandshakeError
- request/builder/build_body_async.rs: use self.request field directly instead of self.request() method
- request/builder/form_data.rs: cast u8 to char for Alphanumeric distribution output

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Owner Author

fewensa commented Mar 10, 2026

use socket2

fewensa and others added 9 commits March 13, 2026 23:01
* Fix refactor dependency compatibility\n\nCo-Authored-By: Paperclip <noreply@paperclip.ing>

* Run CI for refactor PRs\n\nCo-Authored-By: Paperclip <noreply@paperclip.ing>

* Apply rustfmt for CI\n\nCo-Authored-By: Paperclip <noreply@paperclip.ing>

* Fix clippy warnings on refactor branch\n\nCo-Authored-By: Paperclip <noreply@paperclip.ing>
- Remove unused native_tls::TlsConnector import in block_connection.rs
- Fix block_send_https_native cfg to only compile when tls-native is enabled
  without tls-rustls (avoids dead_code warning)
- Remove unused ToUrl import in async_connection.rs
- Fix unnecessary mut on disposition in build_body_async.rs
- Gate no_request_features behind cfg to suppress unused warning
- Add resolver = "2" to workspace Cargo.toml for edition 2021 compatibility
* Implement async TLS via futures-rustls for async_send_https

- Replace async-rustls (rustls 0.21) with futures-rustls 0.26 (rustls 0.23 compatible)
- Implement async_send_https_rustls using TlsConnector from futures-rustls
- TLS path wraps TcpStream in AllowStdIo for futures-io compatibility
- Expose NoCertificateVerification as pub(crate) for reuse across modules
- Update tls-rustls feature to depend on futures-rustls instead of async-rustls
- Also includes async chunked transfer support in async_read_stream and
  connection_reader (sync path); all cargo test --features async,tls-rustls pass

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* feat: use socket2 directly in async_tcp_stream

Replace delegation to block_tcp_stream with inline socket2-based
connection setup in async_tcp_stream. This makes the async path own
its socket2 usage directly rather than calling through the sync path,
removing the fake-async delegation and keeping the implementation
consistent with the sync block_tcp_stream.

- Import socket2, ToSocketAddrs, io, time in async_connection.rs
- async_tcp_stream now creates socket, sets timeouts, connects via socket2
- Ready for future async-runtime integration at this single call-site

Co-Authored-By: Paperclip <noreply@paperclip.ing>

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
Add Auth type with Basic and Bearer variants, and implement the
previously-unimplemented auth() method on HttpClient.

- Add types/auth.rs with Auth::basic() and Auth::bearer() constructors
- Auth::header_value() produces correct Authorization header string
- HttpClient::auth() accepts any AsRef<Auth> and sets Authorization header
- Unit tests for Basic/Bearer header encoding in auth.rs
- Integration tests (test_basic_auth, test_bearer_auth) with echo server
- Add spawn_auth_echo_server() to test support module

Co-authored-by: Paperclip <noreply@paperclip.ing>
@fewensa fewensa marked this pull request as ready for review March 14, 2026 05:26
@fewensa fewensa merged commit c4b35bc into main Mar 14, 2026
1 check passed
@fewensa fewensa deleted the refactor branch March 14, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant