diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-04-02 14:16:10 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-04-02 14:16:10 +0000 |
| commit | 6996f07f5f7b70c8644344658dde5d164d2b0da0 (patch) | |
| tree | 8d93a3ad61254bb729dc865caeaf8528f5c17572 /test/HttpRequestTest.cc | |
| parent | 5cc28b2d8003b0838513d968cb2a9339410e2041 (diff) | |
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
Diffstat (limited to 'test/HttpRequestTest.cc')
| -rw-r--r-- | test/HttpRequestTest.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/test/HttpRequestTest.cc b/test/HttpRequestTest.cc index 5ef923f0..f1dd9a5f 100644 --- a/test/HttpRequestTest.cc +++ b/test/HttpRequestTest.cc @@ -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()); } |
