HttpRequestTest.cc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. #include "HttpRequest.h"
  2. #include "prefs.h"
  3. #include "AuthConfigFactory.h"
  4. #include "PiecedSegment.h"
  5. #include "Piece.h"
  6. #include "Range.h"
  7. #include "Request.h"
  8. #include "CookieBox.h"
  9. #include "Option.h"
  10. #include <cppunit/extensions/HelperMacros.h>
  11. namespace aria2 {
  12. class HttpRequestTest : public CppUnit::TestFixture {
  13. CPPUNIT_TEST_SUITE(HttpRequestTest);
  14. CPPUNIT_TEST(testGetStartByte);
  15. CPPUNIT_TEST(testGetEndByte);
  16. CPPUNIT_TEST(testCreateRequest);
  17. CPPUNIT_TEST(testCreateRequest_ftp);
  18. CPPUNIT_TEST(testCreateRequest_with_cookie);
  19. CPPUNIT_TEST(testCreateProxyRequest);
  20. CPPUNIT_TEST(testIsRangeSatisfied);
  21. CPPUNIT_TEST(testUserAgent);
  22. CPPUNIT_TEST_SUITE_END();
  23. private:
  24. public:
  25. void setUp() {}
  26. void testGetStartByte();
  27. void testGetEndByte();
  28. void testCreateRequest();
  29. void testCreateRequest_ftp();
  30. void testCreateRequest_with_cookie();
  31. void testCreateProxyRequest();
  32. void testIsRangeSatisfied();
  33. void testUserAgent();
  34. };
  35. CPPUNIT_TEST_SUITE_REGISTRATION( HttpRequestTest );
  36. void HttpRequestTest::testGetStartByte()
  37. {
  38. HttpRequest httpRequest;
  39. SharedHandle<Segment> segment = new PiecedSegment(1024, new Piece(1, 1024));
  40. CPPUNIT_ASSERT_EQUAL(0LL, httpRequest.getStartByte());
  41. httpRequest.setSegment(segment);
  42. CPPUNIT_ASSERT_EQUAL(1024LL, httpRequest.getStartByte());
  43. }
  44. void HttpRequestTest::testGetEndByte()
  45. {
  46. size_t index = 1;
  47. size_t length = 1024*1024-1024;
  48. size_t segmentLength = 1024*1024;
  49. HttpRequest httpRequest;
  50. SharedHandle<Segment> segment = new PiecedSegment(segmentLength,
  51. new Piece(index, length));
  52. CPPUNIT_ASSERT_EQUAL(0LL, httpRequest.getEndByte());
  53. httpRequest.setSegment(segment);
  54. CPPUNIT_ASSERT_EQUAL(0LL, httpRequest.getEndByte());
  55. SharedHandle<Request> request = new Request();
  56. request->setKeepAlive(true);
  57. httpRequest.setRequest(request);
  58. CPPUNIT_ASSERT_EQUAL((off_t)segmentLength*index+length-1,
  59. httpRequest.getEndByte());
  60. request->setKeepAlive(false);
  61. CPPUNIT_ASSERT_EQUAL(0LL, httpRequest.getEndByte());
  62. }
  63. void HttpRequestTest::testCreateRequest()
  64. {
  65. Option option;
  66. option.put(PREF_HTTP_AUTH_ENABLED, V_FALSE);
  67. option.put(PREF_HTTP_PROXY_ENABLED, V_FALSE);
  68. option.put(PREF_HTTP_PROXY_METHOD, V_TUNNEL);
  69. option.put(PREF_HTTP_PROXY_AUTH_ENABLED, V_FALSE);
  70. option.put(PREF_HTTP_USER, "aria2user");
  71. option.put(PREF_HTTP_PASSWD, "aria2passwd");
  72. option.put(PREF_HTTP_PROXY_USER, "aria2proxyuser");
  73. option.put(PREF_HTTP_PROXY_PASSWD, "aria2proxypasswd");
  74. SharedHandle<AuthConfigFactory> authConfigFactory = new AuthConfigFactory(&option);
  75. SingletonHolder<SharedHandle<AuthConfigFactory> >::instance(authConfigFactory);
  76. SharedHandle<Request> request = new Request();
  77. request->setUrl("http://localhost:8080/archives/aria2-1.0.0.tar.bz2");
  78. SharedHandle<Segment> segment = new PiecedSegment(1024, new Piece(0, 1024));
  79. HttpRequest httpRequest;
  80. httpRequest.setRequest(request);
  81. httpRequest.setSegment(segment);
  82. request->setKeepAlive(true);
  83. std::string expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  84. "User-Agent: aria2\r\n"
  85. "Accept: */*\r\n"
  86. "Host: localhost:8080\r\n"
  87. "Pragma: no-cache\r\n"
  88. "Cache-Control: no-cache\r\n"
  89. "Range: bytes=0-1023\r\n"
  90. "\r\n";
  91. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  92. request->setKeepAlive(false);
  93. expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  94. "User-Agent: aria2\r\n"
  95. "Accept: */*\r\n"
  96. "Host: localhost:8080\r\n"
  97. "Pragma: no-cache\r\n"
  98. "Cache-Control: no-cache\r\n"
  99. "Connection: close\r\n"
  100. "\r\n";
  101. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  102. segment = new PiecedSegment(1024*1024, new Piece(1, 1024*1024));
  103. httpRequest.setSegment(segment);
  104. expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  105. "User-Agent: aria2\r\n"
  106. "Accept: */*\r\n"
  107. "Host: localhost:8080\r\n"
  108. "Pragma: no-cache\r\n"
  109. "Cache-Control: no-cache\r\n"
  110. "Connection: close\r\n"
  111. "Range: bytes=1048576-\r\n"
  112. "\r\n";
  113. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  114. request->setKeepAlive(true);
  115. expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  116. "User-Agent: aria2\r\n"
  117. "Accept: */*\r\n"
  118. "Host: localhost:8080\r\n"
  119. "Pragma: no-cache\r\n"
  120. "Cache-Control: no-cache\r\n"
  121. "Range: bytes=1048576-2097151\r\n"
  122. "\r\n";
  123. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  124. request->setKeepAlive(false);
  125. request->redirectUrl("http://localhost:8080/archives/download/aria2-1.0.0.tar.bz2");
  126. expectedText = "GET /archives/download/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  127. "User-Agent: aria2\r\n"
  128. "Accept: */*\r\n"
  129. "Host: localhost:8080\r\n"
  130. "Pragma: no-cache\r\n"
  131. "Cache-Control: no-cache\r\n"
  132. "Connection: close\r\n"
  133. "Range: bytes=1048576-\r\n"
  134. "\r\n";
  135. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  136. request->resetUrl();
  137. segment = new PiecedSegment(1024*1024, new Piece(0, 1024*1024));
  138. httpRequest.setSegment(segment);
  139. // enable http auth
  140. option.put(PREF_HTTP_AUTH_ENABLED, V_TRUE);
  141. httpRequest.configure(&option);
  142. expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  143. "User-Agent: aria2\r\n"
  144. "Accept: */*\r\n"
  145. "Host: localhost:8080\r\n"
  146. "Pragma: no-cache\r\n"
  147. "Cache-Control: no-cache\r\n"
  148. "Connection: close\r\n"
  149. "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
  150. "\r\n";
  151. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  152. // enable http proxy auth
  153. option.put(PREF_HTTP_PROXY_AUTH_ENABLED, V_TRUE);
  154. httpRequest.configure(&option);
  155. expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  156. "User-Agent: aria2\r\n"
  157. "Accept: */*\r\n"
  158. "Host: localhost:8080\r\n"
  159. "Pragma: no-cache\r\n"
  160. "Cache-Control: no-cache\r\n"
  161. "Connection: close\r\n"
  162. "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
  163. "\r\n";
  164. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  165. option.put(PREF_HTTP_PROXY_ENABLED, V_TRUE);
  166. httpRequest.configure(&option);
  167. expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  168. "User-Agent: aria2\r\n"
  169. "Accept: */*\r\n"
  170. "Host: localhost:8080\r\n"
  171. "Pragma: no-cache\r\n"
  172. "Cache-Control: no-cache\r\n"
  173. "Connection: close\r\n"
  174. "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
  175. "\r\n";
  176. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  177. option.put(PREF_HTTP_PROXY_METHOD, V_GET);
  178. httpRequest.configure(&option);
  179. expectedText = "GET http://localhost:8080/archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  180. "User-Agent: aria2\r\n"
  181. "Accept: */*\r\n"
  182. "Host: localhost:8080\r\n"
  183. "Pragma: no-cache\r\n"
  184. "Cache-Control: no-cache\r\n"
  185. "Connection: close\r\n"
  186. "Proxy-Connection: close\r\n"
  187. "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n"
  188. "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
  189. "\r\n";
  190. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  191. request->setKeepAlive(true);
  192. expectedText = "GET http://localhost:8080/archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  193. "User-Agent: aria2\r\n"
  194. "Accept: */*\r\n"
  195. "Host: localhost:8080\r\n"
  196. "Pragma: no-cache\r\n"
  197. "Cache-Control: no-cache\r\n"
  198. "Range: bytes=0-1048575\r\n"
  199. "Proxy-Connection: Keep-Alive\r\n"
  200. "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n"
  201. "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
  202. "\r\n";
  203. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  204. request->setKeepAlive(false);
  205. option.put(PREF_HTTP_PROXY_AUTH_ENABLED, V_FALSE);
  206. httpRequest.configure(&option);
  207. expectedText = "GET http://localhost:8080/archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  208. "User-Agent: aria2\r\n"
  209. "Accept: */*\r\n"
  210. "Host: localhost:8080\r\n"
  211. "Pragma: no-cache\r\n"
  212. "Cache-Control: no-cache\r\n"
  213. "Connection: close\r\n"
  214. "Proxy-Connection: close\r\n"
  215. "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
  216. "\r\n";
  217. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  218. }
  219. void HttpRequestTest::testCreateRequest_ftp()
  220. {
  221. Option option;
  222. option.put(PREF_HTTP_AUTH_ENABLED, V_FALSE);
  223. option.put(PREF_HTTP_PROXY_ENABLED, V_FALSE);
  224. option.put(PREF_HTTP_PROXY_METHOD, V_TUNNEL);
  225. option.put(PREF_HTTP_PROXY_AUTH_ENABLED, V_FALSE);
  226. option.put(PREF_HTTP_USER, "aria2user");
  227. option.put(PREF_HTTP_PASSWD, "aria2passwd");
  228. option.put(PREF_HTTP_PROXY_USER, "aria2proxyuser");
  229. option.put(PREF_HTTP_PROXY_PASSWD, "aria2proxypasswd");
  230. SharedHandle<AuthConfigFactory> authConfigFactory = new AuthConfigFactory(&option);
  231. SingletonHolder<SharedHandle<AuthConfigFactory> >::instance(authConfigFactory);
  232. SharedHandle<Request> request = new Request();
  233. request->setUrl("ftp://localhost:8080/archives/aria2-1.0.0.tar.bz2");
  234. HttpRequest httpRequest;
  235. SharedHandle<Segment> segment = new PiecedSegment(1024*1024, new Piece(0, 1024*1024));
  236. httpRequest.setRequest(request);
  237. httpRequest.setSegment(segment);
  238. httpRequest.configure(&option);
  239. std::string expectedText = "GET ftp://localhost:8080/archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  240. "User-Agent: aria2\r\n"
  241. "Accept: */*\r\n"
  242. "Host: localhost:8080\r\n"
  243. "Pragma: no-cache\r\n"
  244. "Cache-Control: no-cache\r\n"
  245. "Connection: close\r\n"
  246. "\r\n";
  247. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  248. // How to enable HTTP proxy authorization in FTP download via HTTP proxy
  249. option.put(PREF_HTTP_PROXY_ENABLED, V_TRUE);
  250. option.put(PREF_HTTP_PROXY_METHOD, V_GET);
  251. option.put(PREF_HTTP_PROXY_AUTH_ENABLED, V_TRUE);
  252. httpRequest.configure(&option);
  253. expectedText = "GET ftp://localhost:8080/archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  254. "User-Agent: aria2\r\n"
  255. "Accept: */*\r\n"
  256. "Host: localhost:8080\r\n"
  257. "Pragma: no-cache\r\n"
  258. "Cache-Control: no-cache\r\n"
  259. "Connection: close\r\n"
  260. "Proxy-Connection: close\r\n"
  261. "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n"
  262. "\r\n";
  263. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  264. }
  265. void HttpRequestTest::testCreateRequest_with_cookie()
  266. {
  267. SharedHandle<Request> request = new Request();
  268. request->setUrl("http://localhost/archives/aria2-1.0.0.tar.bz2");
  269. SharedHandle<Segment> segment = new PiecedSegment(1024*1024, new Piece(0, 1024*1024));
  270. Cookie cookie1("name1", "value1", "/archives", "localhost", false);
  271. Cookie cookie2("name2", "value2", "/archives/download", "localhost", false);
  272. Cookie cookie3("name3", "value3", "/archives/download", "tt.localhost", false);
  273. Cookie cookie4("name4", "value4", "/archives/download", "tt.localhost", true);
  274. request->cookieBox->add(cookie1);
  275. request->cookieBox->add(cookie2);
  276. request->cookieBox->add(cookie3);
  277. request->cookieBox->add(cookie4);
  278. HttpRequest httpRequest;
  279. httpRequest.setRequest(request);
  280. httpRequest.setSegment(segment);
  281. std::string expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  282. "User-Agent: aria2\r\n"
  283. "Accept: */*\r\n"
  284. "Host: localhost\r\n"
  285. "Pragma: no-cache\r\n"
  286. "Cache-Control: no-cache\r\n"
  287. "Connection: close\r\n"
  288. "Cookie: name1=value1;\r\n"
  289. "\r\n";
  290. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  291. request->setUrl("http://localhost/archives/download/aria2-1.0.0.tar.bz2");
  292. expectedText = "GET /archives/download/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  293. "User-Agent: aria2\r\n"
  294. "Accept: */*\r\n"
  295. "Host: localhost\r\n"
  296. "Pragma: no-cache\r\n"
  297. "Cache-Control: no-cache\r\n"
  298. "Connection: close\r\n"
  299. "Cookie: name1=value1;name2=value2;\r\n"
  300. "\r\n";
  301. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  302. request->setUrl("http://tt.localhost/archives/download/aria2-1.0.0.tar.bz2");
  303. expectedText = "GET /archives/download/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  304. "User-Agent: aria2\r\n"
  305. "Accept: */*\r\n"
  306. "Host: tt.localhost\r\n"
  307. "Pragma: no-cache\r\n"
  308. "Cache-Control: no-cache\r\n"
  309. "Connection: close\r\n"
  310. "Cookie: name1=value1;name2=value2;name3=value3;\r\n"
  311. "\r\n";
  312. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  313. request->setUrl("https://tt.localhost/archives/download/aria2-1.0.0.tar.bz2");
  314. expectedText = "GET /archives/download/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  315. "User-Agent: aria2\r\n"
  316. "Accept: */*\r\n"
  317. "Host: tt.localhost\r\n"
  318. "Pragma: no-cache\r\n"
  319. "Cache-Control: no-cache\r\n"
  320. "Connection: close\r\n"
  321. "Cookie: name1=value1;name2=value2;name3=value3;name4=value4;\r\n"
  322. "\r\n";
  323. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  324. }
  325. void HttpRequestTest::testCreateProxyRequest()
  326. {
  327. SharedHandle<Request> request = new Request();
  328. request->setUrl("http://localhost/archives/aria2-1.0.0.tar.bz2");
  329. SharedHandle<Segment> segment = new PiecedSegment(1024*1024, new Piece(0, 1024*1024));
  330. HttpRequest httpRequest;
  331. httpRequest.setRequest(request);
  332. httpRequest.setSegment(segment);
  333. std::string expectedText = "CONNECT localhost:80 HTTP/1.1\r\n"
  334. "User-Agent: aria2\r\n"
  335. "Host: localhost:80\r\n"
  336. "Proxy-Connection: close\r\n"
  337. "\r\n";
  338. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createProxyRequest());
  339. request->setKeepAlive(true);
  340. expectedText = "CONNECT localhost:80 HTTP/1.1\r\n"
  341. "User-Agent: aria2\r\n"
  342. "Host: localhost:80\r\n"
  343. "Proxy-Connection: Keep-Alive\r\n"
  344. "\r\n";
  345. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createProxyRequest());
  346. }
  347. void HttpRequestTest::testIsRangeSatisfied()
  348. {
  349. SharedHandle<Request> request = new Request();
  350. request->setUrl("http://localhost:8080/archives/aria2-1.0.0.tar.bz2");
  351. request->setKeepAlive(false);
  352. SharedHandle<Segment> segment = new PiecedSegment(1024*1024, new Piece(0, 1024*1024));
  353. HttpRequest httpRequest;
  354. httpRequest.setRequest(request);
  355. httpRequest.setSegment(segment);
  356. SharedHandle<Range> range = new Range(0, 0, 0);
  357. CPPUNIT_ASSERT(httpRequest.isRangeSatisfied(range));
  358. segment = new PiecedSegment(1024*1024, new Piece(1, 1024*1024));
  359. httpRequest.setSegment(segment);
  360. CPPUNIT_ASSERT(!httpRequest.isRangeSatisfied(range));
  361. uint64_t entityLength = segment->getSegmentLength()*10;
  362. range = new Range(segment->getPosition(), 0, entityLength);
  363. CPPUNIT_ASSERT(httpRequest.isRangeSatisfied(range));
  364. httpRequest.setEntityLength(entityLength-1);
  365. CPPUNIT_ASSERT(!httpRequest.isRangeSatisfied(range));
  366. httpRequest.setEntityLength(entityLength);
  367. CPPUNIT_ASSERT(httpRequest.isRangeSatisfied(range));
  368. request->setKeepAlive(true);
  369. CPPUNIT_ASSERT(!httpRequest.isRangeSatisfied(range));
  370. range = new Range(segment->getPosition(),
  371. segment->getPosition()+segment->getLength()-1,
  372. entityLength);
  373. CPPUNIT_ASSERT(httpRequest.isRangeSatisfied(range));
  374. range = new Range(0, segment->getPosition()+segment->getLength()-1,
  375. entityLength);
  376. CPPUNIT_ASSERT(!httpRequest.isRangeSatisfied(range));
  377. }
  378. void HttpRequestTest::testUserAgent()
  379. {
  380. Option option;
  381. SharedHandle<AuthConfigFactory> authConfigFactory = new AuthConfigFactory(&option);
  382. SingletonHolder<SharedHandle<AuthConfigFactory> >::instance(authConfigFactory);
  383. SharedHandle<Request> request = new Request();
  384. request->setUrl("http://localhost:8080/archives/aria2-1.0.0.tar.bz2");
  385. SharedHandle<Segment> segment = new PiecedSegment(1024, new Piece(0, 1024));
  386. HttpRequest httpRequest;
  387. httpRequest.setRequest(request);
  388. httpRequest.setSegment(segment);
  389. httpRequest.setUserAgent("aria2 (Linux)");
  390. std::string expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
  391. "User-Agent: aria2 (Linux)\r\n"
  392. "Accept: */*\r\n"
  393. "Host: localhost:8080\r\n"
  394. "Pragma: no-cache\r\n"
  395. "Cache-Control: no-cache\r\n"
  396. "Connection: close\r\n"
  397. "\r\n";
  398. CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
  399. std::string expectedTextForProxy = "CONNECT localhost:8080 HTTP/1.1\r\n"
  400. "User-Agent: aria2 (Linux)\r\n"
  401. "Host: localhost:8080\r\n"
  402. "Proxy-Connection: close\r\n"
  403. "\r\n";
  404. CPPUNIT_ASSERT_EQUAL(expectedTextForProxy, httpRequest.createProxyRequest());
  405. }
  406. } // namespace aria2