diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 4370af89d..c51d6559d 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -63,6 +63,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2022-09-03, Fix HTTP url parsing bug. v4.0.261 * v4.0, 2022-09-03, For [#3167](https://github.com/ossrs/srs/issues/3167): WebRTC: Play stucked when republish. v4.0.260 * v4.0, 2022-09-02, For [#307](https://github.com/ossrs/srs/issues/307): WebRTC: Support use domain name as CANDIDATE. v4.0.259 * v4.0, 2022-08-29, Copy libxml2-dev for FFmpeg. v4.0.258 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 243ad04f9..a43cbf9e9 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 260 +#define VERSION_REVISION 261 #endif diff --git a/trunk/src/protocol/srs_protocol_http_conn.cpp b/trunk/src/protocol/srs_protocol_http_conn.cpp index 7b151857a..c78dc1daa 100644 --- a/trunk/src/protocol/srs_protocol_http_conn.cpp +++ b/trunk/src/protocol/srs_protocol_http_conn.cpp @@ -76,6 +76,8 @@ srs_error_t SrsHttpParser::parse_message(ISrsReader* reader, ISrsHttpMessage** p p_body_start = p_header_tail = NULL; // We must reset the field name and value, because we may get a partial value in on_header_value. field_name = field_value = ""; + // Reset the url. + url = ""; // The header of the request. srs_freep(header); header = new SrsHttpHeader(); @@ -220,7 +222,8 @@ int SrsHttpParser::on_url(http_parser* parser, const char* at, size_t length) srs_assert(obj); if (length > 0) { - obj->url = string(at, (int)length); + // Note that this function might be called for multiple times, and we got pieces of content. + obj->url.append(at, (int)length); } // When header parsed, we must save the position of start for body,