mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-11 20:52:30 +00:00
fix SCGI parse_headers: defer content-type body peek until body received
detect_content_type() peeked at m_buffer[m_body] to infer JSON vs XML
when no CONTENT_TYPE header was provided. When the TCP header segment
arrives without any body bytes, m_body equals m_position and the peek
reads the null terminator padding byte — not the actual '{' or '[' —
causing JSON requests to be incorrectly classified as XML and fail.
Fix:
- Remove the body peek from detect_content_type(); defer it to after
the full body is confirmed present in event_read().
- Add a m_content_type_set flag to distinguish header-provided type
from auto-detected type.
This commit is contained in:
@@ -67,6 +67,7 @@ private:
|
||||
|
||||
bool m_accepts_compression{};
|
||||
bool m_trusted{true};
|
||||
bool m_content_type_set{false};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user