mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
添加onRedirectUrl事件
This commit is contained in:
parent
ed78f152ee
commit
818d26aa66
@ -155,10 +155,12 @@ int64_t HttpClient::onRecvHeader(const char *data, uint64_t len) {
|
|||||||
shutdown(SockException(Err_shutdown,"未找到Location字段(跳转url)"));
|
shutdown(SockException(Err_shutdown,"未找到Location字段(跳转url)"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
HttpClient::clear();
|
if(onRedirectUrl(newUrl,_parser.Url() == "302")){
|
||||||
setMethod("GET");
|
HttpClient::clear();
|
||||||
HttpClient::sendRequest(newUrl,_fTimeOutSec);
|
setMethod("GET");
|
||||||
return 0;
|
HttpClient::sendRequest(newUrl,_fTimeOutSec);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkCookie(_parser.getValues());
|
checkCookie(_parser.getValues());
|
||||||
|
@ -296,6 +296,14 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual void onDisconnect(const SockException &ex){}
|
virtual void onDisconnect(const SockException &ex){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重定向事件
|
||||||
|
* @param url 重定向url
|
||||||
|
* @param temporary 是否为临时重定向
|
||||||
|
* @return 是否继续
|
||||||
|
*/
|
||||||
|
virtual bool onRedirectUrl(const string &url,bool temporary){ return true;};
|
||||||
|
|
||||||
//HttpRequestSplitter override
|
//HttpRequestSplitter override
|
||||||
int64_t onRecvHeader(const char *data,uint64_t len) override ;
|
int64_t onRecvHeader(const char *data,uint64_t len) override ;
|
||||||
void onRecvContent(const char *data,uint64_t len) override;
|
void onRecvContent(const char *data,uint64_t len) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user