summaryrefslogtreecommitdiff
path: root/src/Request.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-11-05 13:00:40 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-11-05 13:00:40 +0900
commit0b515d720412669fd2157ba7c3344a6c7199cd5e (patch)
tree1ec93298cc328624bbaff97ab9595e48de9619e3 /src/Request.h
parent7d68c40a7746121c9e709c173f738c64cfca7603 (diff)
Use uri::UriStruct in Request.h
Diffstat (limited to 'src/Request.h')
-rw-r--r--src/Request.h53
1 files changed, 16 insertions, 37 deletions
diff --git a/src/Request.h b/src/Request.h
index c4653968..36578da4 100644
--- a/src/Request.h
+++ b/src/Request.h
@@ -40,6 +40,7 @@
#include "SharedHandle.h"
#include "TimerA2.h"
+#include "uri.h"
namespace aria2 {
@@ -47,6 +48,7 @@ class PeerStat;
class Request {
private:
+ uri::UriStruct us_;
std::string uri_;
std::string currentUri_;
/**
@@ -57,17 +59,12 @@ private:
* URI used as Referer in the initial request
*/
std::string referer_;
- std::string protocol_;
- std::string host_;
- uint16_t port_;
- std::string dir_;
- std::string file_;
- /* after ? mark(includes '?' itself) */
- std::string query_;
- unsigned int tryCount_;
+ std::string method_;
+ std::string connectedHostname_;
+ std::string connectedAddr_;
+ unsigned int tryCount_;
unsigned int redirectCount_;
-
// whether or not the server supports persistent connection
bool supportsPersistentConnection_;
// enable keep-alive if possible.
@@ -76,27 +73,9 @@ private:
bool pipeliningHint_;
// maximum number of pipelined requests
unsigned int maxPipelinedRequest_;
-
- std::string method_;
-
- std::string username_;
-
- std::string password_;
-
- bool hasPassword_;
-
- bool ipv6LiteralAddress_;
-
SharedHandle<PeerStat> peerStat_;
-
bool removalRequested_;
-
- std::string connectedHostname_;
-
- std::string connectedAddr_;
-
uint16_t connectedPort_;
-
Timer wakeTime_;
bool parseUri(const std::string& uri);
@@ -121,16 +100,16 @@ public:
const std::string& getPreviousUri() const { return previousUri_; }
const std::string& getReferer() const { return referer_; }
void setReferer(const std::string& uri);
- const std::string& getProtocol() const { return protocol_; }
- const std::string& getHost() const { return host_; }
+ const std::string& getProtocol() const { return us_.protocol; }
+ const std::string& getHost() const { return us_.host; }
// Same as getHost(), but for IPv6 literal addresses, enclose them
// with square brackets and return.
std::string getURIHost() const;
- uint16_t getPort() const { return port_; }
- const std::string& getDir() const { return dir_; }
- const std::string& getFile() const { return file_;}
- const std::string& getQuery() const { return query_; }
- bool isIPv6LiteralAddress() const { return ipv6LiteralAddress_; }
+ uint16_t getPort() const { return us_.port; }
+ const std::string& getDir() const { return us_.dir; }
+ const std::string& getFile() const { return us_.file;}
+ const std::string& getQuery() const { return us_.query; }
+ bool isIPv6LiteralAddress() const { return us_.ipv6LiteralAddress; }
void supportsPersistentConnection(bool f)
{
@@ -178,18 +157,18 @@ public:
const std::string& getUsername() const
{
- return username_;
+ return us_.username;
}
const std::string& getPassword() const
{
- return password_;
+ return us_.password;
}
// Returns true if current URI has embedded password.
bool hasPassword() const
{
- return hasPassword_;
+ return us_.hasPassword;
}
const std::string& getMethod() const