mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 11:41:44 +08:00
http客户端支持302跳转
修复HttpRequestSplitter可能内存越界的bug
This commit is contained in:
@@ -148,6 +148,17 @@ void HttpClient::onErr(const SockException &ex) {
|
||||
|
||||
int64_t HttpClient::onRecvHeader(const char *data, uint64_t len) {
|
||||
_parser.Parse(data);
|
||||
if(_parser.Url() == "302" || _parser.Url() == "301"){
|
||||
auto newUrl = _parser["Location"];
|
||||
if(newUrl.empty()){
|
||||
shutdown(SockException(Err_shutdown,"未找到Location字段(跳转url)"));
|
||||
return 0;
|
||||
}
|
||||
HttpClient::sendRequest(newUrl,_fTimeOutSec);
|
||||
HttpRequestSplitter::reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
checkCookie(_parser.getValues());
|
||||
_totalBodySize = onResponseHeader(_parser.Url(), _parser.getValues());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user