#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/server/http_server.h"
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>
#include "base/auto_reset.h"
#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/run_loop.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/test_future.h"
#include "base/time/time.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_with_source.h"
#include "net/server/http_server_request_info.h"
#include "net/socket/tcp_client_socket.h"
#include "net/socket/tcp_server_socket.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/websockets/websocket_frame.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
IsOk;
namespace net {
namespace {
const int kMaxExpectedResponseLength = …;
class TestHttpClient { … };
struct ReceivedRequest { … };
}
class HttpServerTest : public TestWithTaskEnvironment,
public HttpServer::Delegate { … };
namespace {
class WebSocketTest : public HttpServerTest { … };
class WebSocketAcceptingTest : public WebSocketTest { … };
std::string EncodeFrame(std::string message,
WebSocketFrameHeader::OpCodeEnum op_code,
bool mask,
bool finish) { … }
TEST_F(HttpServerTest, Request) { … }
TEST_F(HttpServerTest, RequestBrokenTermination) { … }
TEST_F(HttpServerTest, RequestWithHeaders) { … }
TEST_F(HttpServerTest, RequestWithDuplicateHeaders) { … }
TEST_F(HttpServerTest, HasHeaderValueTest) { … }
TEST_F(HttpServerTest, RequestWithBody) { … }
TEST_F(HttpServerTest, UpgradeIgnored) { … }
TEST_F(WebSocketTest, RequestWebSocket) { … }
TEST_F(WebSocketTest, RequestWebSocketTrailingJunk) { … }
TEST_F(WebSocketAcceptingTest, SendPingFrameWithNoMessage) { … }
TEST_F(WebSocketAcceptingTest, SendPingFrameWithMessage) { … }
TEST_F(WebSocketAcceptingTest, SendPongFrame) { … }
TEST_F(WebSocketAcceptingTest, SendLongTextFrame) { … }
TEST_F(WebSocketAcceptingTest, SendTwoTextFrame) { … }
TEST_F(WebSocketAcceptingTest, SendPingPongFrame) { … }
TEST_F(WebSocketAcceptingTest, SendTextAndPingFrame) { … }
TEST_F(WebSocketAcceptingTest, SendTextAndPingFrameWithMessage) { … }
TEST_F(WebSocketAcceptingTest, SendTextAndPongFrame) { … }
TEST_F(WebSocketAcceptingTest, SendTextPingPongFrame) { … }
TEST_F(HttpServerTest, RequestWithTooLargeBody) { … }
TEST_F(HttpServerTest, Send200) { … }
TEST_F(HttpServerTest, SendRaw) { … }
TEST_F(HttpServerTest, WrongProtocolRequest) { … }
class MockStreamSocket : public StreamSocket { … };
TEST_F(HttpServerTest, RequestWithBodySplitAcrossPackets) { … }
TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) { … }
class CloseOnConnectHttpServerTest : public HttpServerTest { … };
TEST_F(CloseOnConnectHttpServerTest, ServerImmediatelyClosesConnection) { … }
}
}