mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-30 07:26:53 +08:00
parent
788915c7f7
commit
c86e6ba3f1
@ -53,7 +53,7 @@ void Parser::parse(const char *buf, size_t size) {
|
|||||||
if (ptr == buf) {
|
if (ptr == buf) {
|
||||||
auto blank = strchr(ptr, ' ');
|
auto blank = strchr(ptr, ' ');
|
||||||
CHECK(blank > ptr && blank < next_line);
|
CHECK(blank > ptr && blank < next_line);
|
||||||
_method = std::string(ptr, blank);
|
_method = std::string(ptr, blank - ptr);
|
||||||
auto next_blank = strchr(blank + 1, ' ');
|
auto next_blank = strchr(blank + 1, ' ');
|
||||||
CHECK(next_blank && next_blank < next_line);
|
CHECK(next_blank && next_blank < next_line);
|
||||||
_url.assign(blank + 1, next_blank);
|
_url.assign(blank + 1, next_blank);
|
||||||
@ -67,7 +67,7 @@ void Parser::parse(const char *buf, size_t size) {
|
|||||||
} else {
|
} else {
|
||||||
auto pos = strchr(ptr, ':');
|
auto pos = strchr(ptr, ':');
|
||||||
CHECK(pos > ptr && pos < next_line);
|
CHECK(pos > ptr && pos < next_line);
|
||||||
std::string key { ptr, pos };
|
std::string key { ptr, static_cast<std::size_t>(pos - ptr) };
|
||||||
std::string value;
|
std::string value;
|
||||||
if (pos[1] == ' ') {
|
if (pos[1] == ' ') {
|
||||||
value.assign(pos + 2, next_line);
|
value.assign(pos + 2, next_line);
|
||||||
|
Loading…
Reference in New Issue
Block a user