diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-12-01 21:26:58 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-12-01 21:26:58 +0900 |
| commit | f0f4f8f703b8c927fe8008daecb2d0547d486973 (patch) | |
| tree | aa9f93e55f375f342cc72fb62b5d1cca240c07be /src/HttpHeaderProcessor.cc | |
| parent | 6bc215fcec22d8bdf760c78cc25cb8798266c8a5 (diff) | |
Added more error code values.
I have not set error code for all exception invocation.
In this change, I set error code where error likely occurs.
Diffstat (limited to 'src/HttpHeaderProcessor.cc')
| -rw-r--r-- | src/HttpHeaderProcessor.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/HttpHeaderProcessor.cc b/src/HttpHeaderProcessor.cc index 86ba19a0..477d7458 100644 --- a/src/HttpHeaderProcessor.cc +++ b/src/HttpHeaderProcessor.cc @@ -43,6 +43,7 @@ #include "DlRetryEx.h" #include "DlAbortEx.h" #include "A2STR.h" +#include "error_code.h" namespace aria2 { @@ -71,7 +72,8 @@ void HttpHeaderProcessor::update(const std::string& data) void HttpHeaderProcessor::checkHeaderLimit(size_t incomingLength) { if(buf_.size()+incomingLength > limit_) { - throw DL_ABORT_EX("Too large http header"); + throw DL_ABORT_EX2("Too large http header", + error_code::HTTP_PROTOCOL_ERROR); } } @@ -138,7 +140,8 @@ SharedHandle<HttpHeader> HttpHeaderProcessor::getHttpRequestHeader() std::vector<std::string> firstLine; util::split(buf_.substr(0, delimpos), std::back_inserter(firstLine)," ",true); if(firstLine.size() != 3) { - throw DL_ABORT_EX("Malformed HTTP request header."); + throw DL_ABORT_EX2("Malformed HTTP request header.", + error_code::HTTP_PROTOCOL_ERROR); } SharedHandle<HttpHeader> httpHeader(new HttpHeader()); httpHeader->setMethod(firstLine[0]); |
