From ed78f152ee32820b87e2dcdead2c853dfb0d0957 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 1 Jul 2019 18:35:26 +0800 Subject: [PATCH] =?UTF-8?q?Http=20client=20302=E9=94=99=E8=AF=AF=E7=A0=81?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpClient.cpp | 2 ++ src/Http/HttpClient.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/Http/HttpClient.cpp b/src/Http/HttpClient.cpp index fc38021e..a609aa18 100644 --- a/src/Http/HttpClient.cpp +++ b/src/Http/HttpClient.cpp @@ -39,6 +39,7 @@ HttpClient::~HttpClient() { void HttpClient::sendRequest(const string &strUrl, float fTimeOutSec) { _aliveTicker.resetTime(); + _url = strUrl; auto protocol = FindField(strUrl.data(), NULL, "://"); uint16_t defaultPort; bool isHttps; @@ -155,6 +156,7 @@ int64_t HttpClient::onRecvHeader(const char *data, uint64_t len) { return 0; } HttpClient::clear(); + setMethod("GET"); HttpClient::sendRequest(newUrl,_fTimeOutSec); return 0; } diff --git a/src/Http/HttpClient.h b/src/Http/HttpClient.h index f2a5ff1c..642cbc2c 100644 --- a/src/Http/HttpClient.h +++ b/src/Http/HttpClient.h @@ -254,6 +254,10 @@ public: const Parser& response() const{ return _parser; } + + const string &getUrl() const{ + return _url; + } protected: /** * 收到http回复头 @@ -307,6 +311,7 @@ private: protected: bool _isHttps; private: + string _url; HttpHeader _header; HttpBody::Ptr _body; string _method;