summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/HttpHeader.cc20
-rw-r--r--src/HttpHeader.h2
-rw-r--r--src/HttpResponse.cc10
-rw-r--r--src/HttpResponse.h4
-rw-r--r--src/HttpServer.cc11
5 files changed, 7 insertions, 40 deletions
diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc
index d72ca965..40181bd3 100644
--- a/src/HttpHeader.cc
+++ b/src/HttpHeader.cc
@@ -85,26 +85,6 @@ HttpHeader::equalRange(int hdKey) const
return table_.equal_range(hdKey);
}
-int32_t HttpHeader::findAsInt(int hdKey) const
-{
- const std::string& value = find(hdKey);
- if(value.empty()) {
- return 0;
- } else {
- return util::parseInt(value);
- }
-}
-
-int64_t HttpHeader::findAsLLInt(int hdKey) const
-{
- const std::string& value = find(hdKey);
- if(value.empty()) {
- return 0;
- } else {
- return util::parseLLInt(value);
- }
-}
-
RangeHandle HttpHeader::getRange() const
{
const std::string& rangeStr = find(CONTENT_RANGE);
diff --git a/src/HttpHeader.h b/src/HttpHeader.h
index 25f385a0..782a7d27 100644
--- a/src/HttpHeader.h
+++ b/src/HttpHeader.h
@@ -107,8 +107,6 @@ public:
std::pair<std::multimap<int, std::string>::const_iterator,
std::multimap<int, std::string>::const_iterator>
equalRange(int hdKey) const;
- int32_t findAsInt(int hdKey) const;
- int64_t findAsLLInt(int hdKey) const;
SharedHandle<Range> getRange() const;
diff --git a/src/HttpResponse.cc b/src/HttpResponse.cc
index 182de9e3..26272ee2 100644
--- a/src/HttpResponse.cc
+++ b/src/HttpResponse.cc
@@ -271,16 +271,6 @@ int HttpResponse::getStatusCode() const
return httpHeader_->getStatusCode();
}
-bool HttpResponse::hasRetryAfter() const
-{
- return httpHeader_->defined(HttpHeader::RETRY_AFTER);
-}
-
-time_t HttpResponse::getRetryAfter() const
-{
- return httpHeader_->findAsInt(HttpHeader::RETRY_AFTER);
-}
-
Time HttpResponse::getLastModifiedTime() const
{
return Time::parseHTTPDate(httpHeader_->find(HttpHeader::LAST_MODIFIED));
diff --git a/src/HttpResponse.h b/src/HttpResponse.h
index 50f9f2e4..ec286828 100644
--- a/src/HttpResponse.h
+++ b/src/HttpResponse.h
@@ -124,10 +124,6 @@ public:
cuid_ = cuid;
}
- bool hasRetryAfter() const;
-
- time_t getRetryAfter() const;
-
Time getLastModifiedTime() const;
bool supportsPersistentConnection() const;
diff --git a/src/HttpServer.cc b/src/HttpServer.cc
index b7f467b1..afb1ab45 100644
--- a/src/HttpServer.cc
+++ b/src/HttpServer.cc
@@ -148,10 +148,13 @@ SharedHandle<HttpHeader> HttpServer::receiveRequest()
if(setupResponseRecv() < 0) {
A2_LOG_INFO("Request path is invaild. Ignore the request body.");
}
- lastContentLength_ =
- lastRequestHeader_->findAsLLInt(HttpHeader::CONTENT_LENGTH);
- if(lastContentLength_ < 0) {
- throw DL_ABORT_EX("Content-Length must be positive.");
+ if(!util::parseLLIntNoThrow(lastContentLength_,
+ lastRequestHeader_->
+ find(HttpHeader::CONTENT_LENGTH)) ||
+ lastContentLength_ < 0) {
+ throw DL_ABORT_EX(fmt("Invalid Content-Length=%s",
+ lastRequestHeader_->
+ find(HttpHeader::CONTENT_LENGTH).c_str()));
}
headerProcessor_->clear();