mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 21:47:37 +03:00
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
This commit is contained in:
parent
343228629a
commit
884a139e72
27 changed files with 244 additions and 50 deletions
|
@ -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"
|
||||
"Proxy-Connection: close\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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue