summaryrefslogtreecommitdiff
path: root/src/HttpRequest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-03-18 22:01:36 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-03-18 22:01:36 +0900
commitd88e8150334418cff509f9707b0bbf75e7e3c05c (patch)
tree34cac6fc4950247d3190c7724573a4352635790b /src/HttpRequest.cc
parent16a2780bfb91811584e130eda3c517532ef840a3 (diff)
Fix bug that invalid range error when requesting range starting 0
Since the change b782a56b, we use endOffsetOverride_ as the return value of getEndByte(). But aria2 does not send Range header field when range starts 0 (this is because some server returns error if it received Range: 0-), and the HttpRequest::isRangeSatisfied() checks the equality of getEndByte() and the end byte in response header and fails. The fix is send Range header if getEndByte() is set.
Diffstat (limited to 'src/HttpRequest.cc')
-rw-r--r--src/HttpRequest.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc
index 3bb5df1f..5efc56f4 100644
--- a/src/HttpRequest.cc
+++ b/src/HttpRequest.cc
@@ -199,7 +199,8 @@ std::string HttpRequest::createRequest()
builtinHds.push_back(std::make_pair("Connection:", "close"));
}
if(segment_ && segment_->getLength() > 0 &&
- (request_->isPipeliningEnabled() || getStartByte() > 0)) {
+ (request_->isPipeliningEnabled() || getStartByte() > 0 ||
+ getEndByte() > 0)) {
std::string rangeHeader(fmt("bytes=%" PRId64 "-", getStartByte()));
if(request_->isPipeliningEnabled()) {
rangeHeader += util::itos(getEndByte());