@@ -1061,7 +1061,6 @@ fn connection_poisoning() {
1061
1061
assert_eq ! ( num_requests. load( Ordering :: SeqCst ) , 5 ) ;
1062
1062
}
1063
1063
1064
-
1065
1064
// -------------------------------------------------------
1066
1065
// Below is our custom code for testing hyper legacy-client behavior with mock connections for PR #184
1067
1066
// We use fully qualified paths for all types and identifiers to make this code
@@ -1147,7 +1146,10 @@ impl hyper::rt::Read for MockConnection {
1147
1146
buf : hyper:: rt:: ReadBufCursor < ' _ > ,
1148
1147
) -> std:: task:: Poll < std:: result:: Result < ( ) , std:: io:: Error > > {
1149
1148
// Log the current state of the failed flag for debugging.
1150
- eprintln ! ( "poll_read: failed={}" , self . failed. load( std:: sync:: atomic:: Ordering :: SeqCst ) ) ;
1149
+ eprintln ! (
1150
+ "poll_read: failed={}" ,
1151
+ self . failed. load( std:: sync:: atomic:: Ordering :: SeqCst )
1152
+ ) ;
1151
1153
// Check if the connection is marked as failed.
1152
1154
// If true, return the stored error immediately to simulate a connection failure.
1153
1155
if self . failed . load ( std:: sync:: atomic:: Ordering :: SeqCst ) {
@@ -1188,7 +1190,10 @@ impl hyper::rt::Write for MockConnection {
1188
1190
// Increment the total bytes written for tracking.
1189
1191
self . bytes_written += bytes;
1190
1192
// Log the number of bytes written and the running total.
1191
- eprintln ! ( "poll_write: wrote {} bytes, total={}" , bytes, self . bytes_written) ;
1193
+ eprintln ! (
1194
+ "poll_write: wrote {} bytes, total={}" ,
1195
+ bytes, self . bytes_written
1196
+ ) ;
1192
1197
// If error_tx is present, signal an unexpected write (used in error tests).
1193
1198
// This helps detect writes when the connection should fail early.
1194
1199
if let Some ( tx) = self . error_tx . take ( ) {
@@ -1272,9 +1277,8 @@ impl tower_service::Service<hyper::Uri> for MockConnector {
1272
1277
type Error = std:: io:: Error ;
1273
1278
type Future = std:: pin:: Pin <
1274
1279
Box <
1275
- dyn futures_util:: Future <
1276
- Output = std:: result:: Result < Self :: Response , Self :: Error > ,
1277
- > + Send ,
1280
+ dyn futures_util:: Future < Output = std:: result:: Result < Self :: Response , Self :: Error > >
1281
+ + Send ,
1278
1282
> ,
1279
1283
> ;
1280
1284
@@ -1362,11 +1366,9 @@ async fn test_connection_error_propagation_pr184() {
1362
1366
let connector = crate :: MockConnector :: new ( io_builder, Some ( io_error. clone ( ) ) ) ;
1363
1367
// Build the hyper client with TokioExecutor and our connector.
1364
1368
// pool_max_idle_per_host(0) disables connection pooling for a fresh connection.
1365
- let client = hyper_util:: client:: legacy:: Client :: builder (
1366
- hyper_util:: rt:: TokioExecutor :: new ( )
1367
- )
1368
- . pool_max_idle_per_host ( 0 )
1369
- . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
1369
+ let client = hyper_util:: client:: legacy:: Client :: builder ( hyper_util:: rt:: TokioExecutor :: new ( ) )
1370
+ . pool_max_idle_per_host ( 0 )
1371
+ . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
1370
1372
// Build a GET request to a mock URI with custom headers.
1371
1373
// Uses mixed-case headers to match your style, ensuring case-insensitive handling.
1372
1374
let request = hyper:: Request :: builder ( )
@@ -1417,11 +1419,9 @@ async fn test_incomplete_message_error_pr184() {
1417
1419
let connector = crate :: MockConnector :: new ( io_builder, None ) ;
1418
1420
// Build the hyper client with TokioExecutor and our connector.
1419
1421
// pool_max_idle_per_host(0) disables pooling for a fresh connection.
1420
- let client = hyper_util:: client:: legacy:: Client :: builder (
1421
- hyper_util:: rt:: TokioExecutor :: new ( )
1422
- )
1423
- . pool_max_idle_per_host ( 0 )
1424
- . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
1422
+ let client = hyper_util:: client:: legacy:: Client :: builder ( hyper_util:: rt:: TokioExecutor :: new ( ) )
1423
+ . pool_max_idle_per_host ( 0 )
1424
+ . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
1425
1425
// Build a GET request to a mock URI with headers.
1426
1426
// Uses mixed-case headers to match test_connection_error_propagation_pr184.
1427
1427
// Empty body ensures focus on response parsing failure.
@@ -1487,11 +1487,9 @@ async fn test_successful_connection() {
1487
1487
let connector = crate :: MockConnector :: new ( io_builder, None ) ;
1488
1488
// Build the hyper client with TokioExecutor and our connector.
1489
1489
// pool_max_idle_per_host(0) ensures a fresh connection.
1490
- let client = hyper_util:: client:: legacy:: Client :: builder (
1491
- hyper_util:: rt:: TokioExecutor :: new ( )
1492
- )
1493
- . pool_max_idle_per_host ( 0 )
1494
- . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
1490
+ let client = hyper_util:: client:: legacy:: Client :: builder ( hyper_util:: rt:: TokioExecutor :: new ( ) )
1491
+ . pool_max_idle_per_host ( 0 )
1492
+ . build :: < _ , http_body_util:: Empty < hyper:: body:: Bytes > > ( connector) ;
1495
1493
// Build a GET request to a mock URI with headers.
1496
1494
// Uses mixed-case headers to match your style and verify case-insensitive handling.
1497
1495
let request = hyper:: Request :: builder ( )
0 commit comments