summaryrefslogtreecommitdiff
path: root/test/HttpRequestTest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-10-17 16:26:51 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-10-17 16:26:51 +0000
commit884a139e725f4c3968929dca734eef6812cf2e6f (patch)
tree725212a598e43041bca09a082da1cf1cd6e7c8e6 /test/HttpRequestTest.cc
parent343228629a69870cf47640a63e32f7b237403aa5 (diff)
2007-10-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added HTTP/1.1 keep alive and pipelining support. See --enable-http-keep-alive and --enable-http-pipelining option. * src/AbstractCommand.{h, cc}: Now it has one-to-many relation to Segment. * src/HttpDownloadCommand.{h, cc} * src/OptionHandlerFactory.cc * src/HttpConnection.{h, cc} * src/version_usage.cc * src/HttpInitiateConnectionCommand.cc * src/FtpInitiateConnectionCommand.cc * src/Segment.h * src/HttpRequestCommand.{h, cc} * src/option_processing.cc * src/prefs.h * src/HttpResponseCommand.cc * src/SegmentMan.{h, cc} * src/FtpNegotiateCommand.cc * src/HttpProxyResponseCommand.cc * src/Request.cc * src/HttpRequest.cc * src/DownloadCommand.cc * test/HttpRequestTest.cc * test/RequestTest.cc
Diffstat (limited to 'test/HttpRequestTest.cc')
-rw-r--r--test/HttpRequestTest.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/HttpRequestTest.cc b/test/HttpRequestTest.cc
index 002f2260..2388aace 100644
--- a/test/HttpRequestTest.cc
+++ b/test/HttpRequestTest.cc
@@ -248,6 +248,24 @@ void HttpRequestTest::testCreateRequest()
CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
+ request->setKeepAlive(true);
+
+ expectedText = "GET http://localhost:8080/archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
+ "User-Agent: aria2\r\n"
+ "Accept: */*\r\n"
+ "Host: localhost:8080\r\n"
+ "Pragma: no-cache\r\n"
+ "Cache-Control: no-cache\r\n"
+ "Range: bytes=0-1048575\r\n"
+ "Proxy-Connection: Keep-Alive\r\n"
+ "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n"
+ "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
+ "\r\n";
+
+ CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
+
+ request->setKeepAlive(false);
+
option->put(PREF_HTTP_PROXY_AUTH_ENABLED, V_FALSE);
httpRequest.configure(option.get());
@@ -414,8 +432,18 @@ void HttpRequestTest::testCreateProxyRequest()
string expectedText = "CONNECT localhost:80 HTTP/1.1\r\n"
"User-Agent: aria2\r\n"
+ "Host: localhost:80\r\n"
"Proxy-Connection: close\r\n"
+ "\r\n";
+
+ CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createProxyRequest());
+
+ request->setKeepAlive(true);
+
+ expectedText = "CONNECT localhost:80 HTTP/1.1\r\n"
+ "User-Agent: aria2\r\n"
"Host: localhost:80\r\n"
+ "Proxy-Connection: Keep-Alive\r\n"
"\r\n";
CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createProxyRequest());