diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-29 12:43:45 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-29 12:43:45 +0000 |
| commit | 8b27671e58d6c071fb231d4ad8ddecb28255f86e (patch) | |
| tree | c28d0a378d4bf823919d012bfe0e3c97916ef149 /test/HttpRequestTest.cc | |
| parent | eecd51bcb58e1263a1b75722eb0d4a7780d02124 (diff) | |
2007-10-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Use File::renameTo()
* src/DefaultBtProgressInfoFile.cc
Added --no-file-allocation-limit command-line option.
* src/version_usage.cc
* src/option_processing.cc
* src/OptionHandlerFactory.cc
* src/RequestGroup.{h, cc}
* src/BtCheckIntegrityEntry.cc
* src/StreamCheckIntegrityEntry.cc
* src/prefs.h
* doc/aria2c.1.txt
* doc/aria2c.1
Now prealloc is the default value for --file-allocation option.
* src/version_usage.cc
* src/option_processing.cc
* doc/aria2c.1.txt
* doc/aria2c.1
Don't URL-encode user-agent.
* src/HttpRequest.cc
Updated translations
* po/LINGUAS: Added nl for Dutch translation.
* po/nl.po: Added Dutch translation, thanks to A. Bram Neijt.
* po/de.po: Updated German translation, thanks to Patrick
Ruckstuhl.
* po/POTFILES.in: Updated.
Diffstat (limited to 'test/HttpRequestTest.cc')
| -rw-r--r-- | test/HttpRequestTest.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/HttpRequestTest.cc b/test/HttpRequestTest.cc index 2388aace..836b7dd9 100644 --- a/test/HttpRequestTest.cc +++ b/test/HttpRequestTest.cc @@ -17,6 +17,7 @@ class HttpRequestTest : public CppUnit::TestFixture { CPPUNIT_TEST(testCreateRequest_with_cookie); CPPUNIT_TEST(testCreateProxyRequest); CPPUNIT_TEST(testIsRangeSatisfied); + CPPUNIT_TEST(testUserAgent); CPPUNIT_TEST_SUITE_END(); private: @@ -30,6 +31,7 @@ public: void testCreateRequest_with_cookie(); void testCreateProxyRequest(); void testIsRangeSatisfied(); + void testUserAgent(); }; @@ -500,3 +502,40 @@ void HttpRequestTest::testIsRangeSatisfied() CPPUNIT_ASSERT(!httpRequest.isRangeSatisfied(range)); } + +void HttpRequestTest::testUserAgent() +{ + SharedHandle<Option> option = new Option(); + RequestFactory requestFactory; + requestFactory.setOption(option.get()); + + RequestHandle request = requestFactory.createRequest(); + request->setUrl("http://localhost:8080/archives/aria2-1.0.0.tar.bz2"); + + SegmentHandle segment = new PiecedSegment(1024, new Piece(0, 1024)); + + HttpRequest httpRequest; + + httpRequest.setRequest(request); + httpRequest.setSegment(segment); + httpRequest.setUserAgent("aria2 (Linux)"); + + string expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n" + "User-Agent: aria2 (Linux)\r\n" + "Accept: */*\r\n" + "Host: localhost:8080\r\n" + "Pragma: no-cache\r\n" + "Cache-Control: no-cache\r\n" + "Connection: close\r\n" + "\r\n"; + + CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest()); + + string expectedTextForProxy = "CONNECT localhost:8080 HTTP/1.1\r\n" + "User-Agent: aria2 (Linux)\r\n" + "Host: localhost:8080\r\n" + "Proxy-Connection: close\r\n" + "\r\n"; + + CPPUNIT_ASSERT_EQUAL(expectedTextForProxy, httpRequest.createProxyRequest()); +} |
