diff --git a/rpxy-lib/src/forwarder/client.rs b/rpxy-lib/src/forwarder/client.rs index 9aab75a..5718f2e 100644 --- a/rpxy-lib/src/forwarder/client.rs +++ b/rpxy-lib/src/forwarder/client.rs @@ -74,10 +74,15 @@ where return res.map(wrap_incoming_body_response::); }; let (parts, body) = res.unwrap().into_parts(); + let Ok(bytes) = body.collect().await.map(|v| v.to_bytes()) else { return Err(RpxyError::FailedToWriteByteBufferForCache); }; + // TODO: this is inefficient. needs to be reconsidered to avoid unnecessary copy and should spawn async task to store cache. + // We may need to use the same logic as h3. + // Is bytes.clone() enough? + // if let Err(cache_err) = self // .cache // .as_ref() diff --git a/rpxy-lib/src/proxy/proxy_h3.rs b/rpxy-lib/src/proxy/proxy_h3.rs index 8abb710..d194b1f 100644 --- a/rpxy-lib/src/proxy/proxy_h3.rs +++ b/rpxy-lib/src/proxy/proxy_h3.rs @@ -122,7 +122,7 @@ where size += body.remaining(); if size > max_body_size { error!( - "Exceeds max request body size for HTTP/3: received {}, maximum_allowd {}", + "Exceeds max request body size for HTTP/3: received {}, maximum_allowed {}", size, max_body_size ); return Err(RpxyError::H3TooLargeBody);