Commit ed78f152 by xiongziliang

Http client 302错误码支持

parent 339fdf0d
...@@ -39,6 +39,7 @@ HttpClient::~HttpClient() { ...@@ -39,6 +39,7 @@ HttpClient::~HttpClient() {
void HttpClient::sendRequest(const string &strUrl, float fTimeOutSec) { void HttpClient::sendRequest(const string &strUrl, float fTimeOutSec) {
_aliveTicker.resetTime(); _aliveTicker.resetTime();
_url = strUrl;
auto protocol = FindField(strUrl.data(), NULL, "://"); auto protocol = FindField(strUrl.data(), NULL, "://");
uint16_t defaultPort; uint16_t defaultPort;
bool isHttps; bool isHttps;
...@@ -155,6 +156,7 @@ int64_t HttpClient::onRecvHeader(const char *data, uint64_t len) { ...@@ -155,6 +156,7 @@ int64_t HttpClient::onRecvHeader(const char *data, uint64_t len) {
return 0; return 0;
} }
HttpClient::clear(); HttpClient::clear();
setMethod("GET");
HttpClient::sendRequest(newUrl,_fTimeOutSec); HttpClient::sendRequest(newUrl,_fTimeOutSec);
return 0; return 0;
} }
......
...@@ -254,6 +254,10 @@ public: ...@@ -254,6 +254,10 @@ public:
const Parser& response() const{ const Parser& response() const{
return _parser; return _parser;
} }
const string &getUrl() const{
return _url;
}
protected: protected:
/** /**
* 收到http回复头 * 收到http回复头
...@@ -307,6 +311,7 @@ private: ...@@ -307,6 +311,7 @@ private:
protected: protected:
bool _isHttps; bool _isHttps;
private: private:
string _url;
HttpHeader _header; HttpHeader _header;
HttpBody::Ptr _body; HttpBody::Ptr _body;
string _method; string _method;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论