🐛 bug: don't send Content-Length to relay if status code is 304 Not Modified
Thanks to Nginx for noticing thismain
parent
2656d16264
commit
e5d157e1af
|
@ -97,9 +97,12 @@ async fn handle_one_req (
|
||||||
.header (ptth_core::PTTH_MAGIC_HEADER, base64::encode (rmp_serde::to_vec (&response.parts).map_err (ServerError::MessagePackEncodeResponse)?))
|
.header (ptth_core::PTTH_MAGIC_HEADER, base64::encode (rmp_serde::to_vec (&response.parts).map_err (ServerError::MessagePackEncodeResponse)?))
|
||||||
.header ("X-PTTH-SERVER-NAME", &state.config.name);
|
.header ("X-PTTH-SERVER-NAME", &state.config.name);
|
||||||
|
|
||||||
if let Some (length) = response.content_length {
|
if response.parts.status_code != ptth_core::http_serde::StatusCode::NotModified {
|
||||||
resp_req = resp_req.header ("Content-Length", length.to_string ());
|
if let Some (length) = response.content_length {
|
||||||
|
resp_req = resp_req.header ("Content-Length", length.to_string ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some (mut body) = response.body {
|
if let Some (mut body) = response.body {
|
||||||
if state.config.throttle_upload {
|
if state.config.throttle_upload {
|
||||||
// Spawn another task to throttle the chunks
|
// Spawn another task to throttle the chunks
|
||||||
|
|
Loading…
Reference in New Issue