Closed sin-zx closed 1 year ago
Execute ffmpeg -re -i ./test1_out.mp4 -c copy -f flv "rtmp://127.0.0.1/live/livestream?a=1#b=2" The rtmp push streaming URL contains multiple parameters, separated by "#". However, only the first part of the parameter "?a=1" is obtained in the on_publish callback. Expected: The param should contain the complete first part of the parameter "?a=1#b=2".
According to the definition of URI
in RFC 3986, ?
represents the query, and #
represents the fragment. If a=1#b=2
is forcibly interpreted as a query, will it cause other compatibility issues?
After taking a look, the relevant code is in the function srs_error_t SrsHttpUri::initialize(string url)
in srs_protocol_http_stack.cpp
.
In this function:
http_parser_parse_url
is responsible for parsing the URI.query = get_uri_field(parsing_url, &hp_u, UF_QUERY);
is responsible for extracting the query.In the above code, b=2
is interpreted as a fragment instead of a query, so the callback parameter param
is incomplete.
TRANS_BY_GPT3
http parser has this field:
, UF_QUERY = 4
, UF_FRAGMENT = 5
However, SRS only retrieves the query:
srs_error_t SrsHttpUri::initialize(string url) {
query = get_uri_field(parsing_url, &hp_u, UF_QUERY);
It is equivalent to discarding the fragment, but the fragment should be saved.
During the callback, both the query and fragment can be placed in the param.
"param":"?token=xxx&salt=yyy#fragment"
Here it is not a query, but a param parameter, so it can include a fragment.
TRANS_BY_GPT3
Description (描述)
SRS Version: Release v5.0.63
SRS Log:
Replay:
> Please describe how to replay the bug? (重现Bug的步骤)
Translation:
Translation:
Translation:
TRANS_BY_GPT3