mirror of
https://github.com/aria2/aria2.git
synced 2026-04-02 10:55:00 +00:00
2010-04-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Don't send "Accept: default, gzip" by default. This is because some server responds with "Content-Encoding: gzip" for files which itself is gzipped file and aria2 inflates them. This is a problem if user don't want to inflate the file. Apparently this is server configuration error, but I cannot do anything about this. So turn this off. Added --http-accept-gzip option. If true is given to this option, aria2 sends 'Accept: deflate, gzip' request header and inflates response if remote server responds with 'Content-Encoding: gzip' or 'Content-Encoding: deflate'. This indicates we removed extension tgz hack in order not to inflate files with tgz extensions. * doc/aria2c.1.txt * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/OptionHandlerFactory.cc * src/prefs.cc * src/prefs.h * src/usage_text.h * test/HttpRequestTest.cc
This commit is contained in:
@@ -719,20 +719,30 @@ void HttpRequestTest::testEnableAcceptEncoding()
|
||||
acceptEncodings += "deflate, gzip";
|
||||
#endif // HAVE_LIBZ
|
||||
|
||||
std::string expectedText =
|
||||
std::string expectedTextHead =
|
||||
"GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
|
||||
"User-Agent: aria2\r\n"
|
||||
"Accept: */*\r\n";
|
||||
if(!acceptEncodings.empty()) {
|
||||
expectedText += "Accept-Encoding: "+acceptEncodings+"\r\n";
|
||||
}
|
||||
expectedText +=
|
||||
std::string expectedTextTail =
|
||||
"Host: localhost\r\n"
|
||||
"Pragma: no-cache\r\n"
|
||||
"Cache-Control: no-cache\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n";
|
||||
|
||||
std::string expectedText = expectedTextHead;
|
||||
expectedText += expectedTextTail;
|
||||
CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
|
||||
|
||||
expectedText = expectedTextHead;
|
||||
if(!acceptEncodings.empty()) {
|
||||
expectedText += "Accept-Encoding: ";
|
||||
expectedText += acceptEncodings;
|
||||
expectedText += "\r\n";
|
||||
}
|
||||
expectedText += expectedTextTail;
|
||||
|
||||
httpRequest.enableAcceptGZip();
|
||||
CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user