diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-21 10:48:11 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-21 10:48:11 +0000 |
| commit | e1fa62e6c7ce3617b8bb72b4ffe63f505cc0fdda (patch) | |
| tree | 4e68de6b8c0fe23eb681dd5937b0e4409d6dbccf /src/HttpHeader.cc | |
| parent | 3eb74629cbd0f01113bc581d486a8ec95633b4ad (diff) | |
2008-04-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Now HTTP status and version are a member variable of HttpHeader.
HTTP status is processed as a string, not integer.
* src/AbstractProxyResponseCommand.cc
* src/HttpConnection.cc
* src/HttpHeader.cc
* src/HttpHeader.h
* src/HttpHeaderProcessor.cc
* src/HttpHeaderProcessor.h
* src/HttpResponse.cc
* src/HttpResponse.h
* test/HttpHeaderProcessorTest.cc
* test/HttpResponseTest.cc
Diffstat (limited to 'src/HttpHeader.cc')
| -rw-r--r-- | src/HttpHeader.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 9a9ad225..5a80665e 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -35,6 +35,7 @@ #include "HttpHeader.h" #include "Range.h" #include "Util.h" +#include <istream> namespace aria2 { @@ -120,4 +121,38 @@ RangeHandle HttpHeader::getRange() const return SharedHandle<Range>(new Range(startByte, endByte, entityLength)); } +const std::string& HttpHeader::getResponseStatus() const +{ + return _responseStatus; +} + +void HttpHeader::setResponseStatus(const std::string& responseStatus) +{ + _responseStatus = responseStatus; +} + +const std::string& HttpHeader::getVersion() const +{ + return _version; +} + +void HttpHeader::setVersion(const std::string& version) +{ + _version = version; +} + +void HttpHeader::fill(std::istream& in) +{ + std::string line; + while(std::getline(in, line)) { + line = Util::trim(line); + if(line.empty()) { + break; + } + std::pair<std::string, std::string> hp; + Util::split(hp, line, ':'); + put(hp.first, hp.second); + } +} + } // namespace aria2 |
