summaryrefslogtreecommitdiff
path: root/src/HttpSkipResponseCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-11-23 15:00:44 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-11-23 15:00:44 +0000
commit62105714efdf6422d049ca34808db96a2b6eabae (patch)
treee848b9fa9ceb10f62d170ac9004adb34fd724262 /src/HttpSkipResponseCommand.cc
parentc104ac83195be28049561b027d846d836ba6cff3 (diff)
2008-11-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use HEAD method to get file size from HTTP server for segmented downloading. The request to the BitTorrent Tracker always uses GET method because the response of the tracker is small and it doesn't need segmented download. * src/FtpNegotiationCommand.cc * src/HttpRequest.cc * src/HttpResponseCommand.cc * src/HttpSkipResponseCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/TrackerWatcherCommand.cc * test/HttpRequestTest.cc
Diffstat (limited to 'src/HttpSkipResponseCommand.cc')
-rw-r--r--src/HttpSkipResponseCommand.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/HttpSkipResponseCommand.cc b/src/HttpSkipResponseCommand.cc
index 90511203..f1ae1f03 100644
--- a/src/HttpSkipResponseCommand.cc
+++ b/src/HttpSkipResponseCommand.cc
@@ -80,12 +80,14 @@ void HttpSkipResponseCommand::setTransferEncodingDecoder
bool HttpSkipResponseCommand::executeInternal()
{
- if(_totalLength == 0 && _transferEncodingDecoder.isNull()) {
- // If content-length header is present and it's value is 0, then
- // pool socket for reuse.
+ if(req->getMethod() == Request::METHOD_HEAD ||
+ (_totalLength == 0 && _transferEncodingDecoder.isNull())) {
+ // If request method is HEAD or content-length header is present and
+ // it's value is 0, then pool socket for reuse.
// If content-length header is not present, then EOF is expected in the end.
// In this case, the content is thrown away and socket cannot be pooled.
- if(_httpResponse->getHttpHeader()->defined(HttpHeader::CONTENT_LENGTH)) {
+ if(req->getMethod() == Request::METHOD_HEAD ||
+ _httpResponse->getHttpHeader()->defined(HttpHeader::CONTENT_LENGTH)) {
poolConnection();
}
return processResponse();