| 687 | } |
| 688 | |
| 689 | size_t DoTestHttpOutputSize(const TString& res, bool enableCompession) { |
| 690 | TTestHttpServer serverImpl(res); |
| 691 | TPortManager pm; |
| 692 | |
| 693 | const ui16 port = pm.GetPort(); |
| 694 | THttpServer server(&serverImpl, |
| 695 | THttpServer::TOptions(port) |
| 696 | .EnableKeepAlive(true) |
| 697 | .EnableCompression(enableCompession)); |
| 698 | UNIT_ASSERT(server.Start()); |
| 699 | |
| 700 | TNetworkAddress addr("localhost", port); |
| 701 | TSocket s(addr); |
| 702 | |
| 703 | { |
| 704 | TSocketOutput so(s); |
| 705 | THttpOutput out(&so); |
| 706 | out << "GET / HTTP/1.1\r\n" |
| 707 | "Host: www.yandex.ru\r\n" |
| 708 | "Connection: Keep-Alive\r\n" |
| 709 | "Accept-Encoding: gzip\r\n" |
| 710 | "\r\n"; |
| 711 | out.Finish(); |
| 712 | } |
| 713 | |
| 714 | TSocketInput si(s); |
| 715 | THttpInput input(&si); |
| 716 | |
| 717 | unsigned httpCode = ParseHttpRetCode(input.FirstLine()); |
| 718 | UNIT_ASSERT_VALUES_EQUAL(httpCode, 200u); |
| 719 | |
| 720 | UNIT_ASSERT_VALUES_EQUAL(res, input.ReadAll()); |
| 721 | |
| 722 | server.Stop(); |
| 723 | |
| 724 | return serverImpl.LastRequestSentSize(); |
| 725 | } |
| 726 | |
| 727 | Y_UNIT_TEST(TestHttpOutputSize) { |
| 728 | TString res = "qqqqqq"; |
no test coverage detected