diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-11 16:58:24 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-11 16:58:24 +0000 |
| commit | 048a2cf59737f761876e81a77e8d064c45c752d7 (patch) | |
| tree | 65c9d5498aafe6a8c8e640ddfcc43c7013504d0d /src/HttpRequest.cc | |
| parent | e26bbbb9eee140ba24402fe872a752b42f0077de (diff) | |
2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented BitTorrent/http/ftp integrated download.
I've rewritten lots of files and now some headers have forward
class declarations to reduce compile time.
The implementation is extremely alpha stage, I recommend to use this
for testing purpose only.
Diffstat (limited to 'src/HttpRequest.cc')
| -rw-r--r-- | src/HttpRequest.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 603523d8..942f6947 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -40,7 +40,7 @@ RangeHandle HttpRequest::getRange() const { // content-length is always 0 - if(segment->isNull()) { + if(segment.isNull()) { return new Range(0, 0, 0); } else { return new Range(getStartByte(), getEndByte(), entityLength); @@ -49,7 +49,7 @@ RangeHandle HttpRequest::getRange() const bool HttpRequest::isRangeSatisfied(const RangeHandle& range) const { - if(segment->isNull()) { + if(segment.isNull()) { return true; } if(getStartByte() == range->getStartByte() && @@ -83,7 +83,7 @@ string HttpRequest::createRequest() const } requestLine += string(" HTTP/1.1\r\n")+ - "User-Agent: "+Util::urlencode(userAgent)+"\r\n"+ + "User-Agent: "+userAgent+"\r\n"+ "Accept: */*\r\n"+ /* */ "Host: "+getHostText(getHost(), getPort())+"\r\n"+ "Pragma: no-cache\r\n"+ @@ -91,7 +91,8 @@ string HttpRequest::createRequest() const if(!request->isKeepAlive()) { requestLine += "Connection: close\r\n"; } - if(segment->length > 0) { + if(!segment.isNull() && segment->getLength() > 0 && + (request->isKeepAlive() || getStartByte() > 0)) { requestLine += "Range: bytes="+Util::llitos(getStartByte()); requestLine += "-"; if(request->isKeepAlive()) { @@ -112,7 +113,6 @@ string HttpRequest::createRequest() const if(getPreviousURI().size()) { requestLine += "Referer: "+getPreviousURI()+"\r\n"; } - string cookiesValue; Cookies cookies = request->cookieBox->criteriaFind(getHost(), getDir(), |
