proxygen
|
#include <folly/portability/GTest.h>
#include <proxygen/lib/http/HTTPHeaderSize.h>
#include <proxygen/lib/http/HTTPMessage.h>
#include <proxygen/lib/http/codec/HTTP1xCodec.h>
#include <proxygen/lib/http/codec/test/MockHTTPCodec.h>
#include <proxygen/lib/http/codec/test/TestUtils.h>
#include <proxygen/lib/utils/Base64.h>
Go to the source code of this file.
Classes | |
class | HTTP1xCodecCallback |
class | ConnectionHeaderTest |
Functions | |
unique_ptr< folly::IOBuf > | getSimpleRequestData () |
TEST (HTTP1xCodecTest, TestSimpleHeaders) | |
TEST (HTTP1xCodecTest, Test09Req) | |
TEST (HTTP1xCodecTest, Test09ReqVers) | |
TEST (HTTP1xCodecTest, Test09Resp) | |
TEST (HTTP1xCodecTest, TestBadHeaders) | |
TEST (HTTP1xCodecTest, TestHeadRequestChunkedResponse) | |
TEST (HTTP1xCodecTest, TestGetRequestChunkedResponse) | |
unique_ptr< folly::IOBuf > | getChunkedRequest1st () |
unique_ptr< folly::IOBuf > | getChunkedRequest2nd () |
TEST (HTTP1xCodecTest, TestChunkedHeaders) | |
TEST (HTTP1xCodecTest, TestChunkedUpstream) | |
TEST (HTTP1xCodecTest, TestBadPost100) | |
TEST (HTTP1xCodecTest, TestMultipleIdenticalContentLengthHeaders) | |
TEST (HTTP1xCodecTest, TestMultipleDistinctContentLengthHeaders) | |
TEST (HTTP1xCodecTest, TestCorrectTransferEncodingHeader) | |
TEST (HTTP1xCodecTest, TestFoldedTransferEncodingHeader) | |
TEST (HTTP1xCodecTest, TestBadTransferEncodingHeader) | |
TEST (HTTP1xCodecTest, Test1xxConnectionHeader) | |
TEST (HTTP1xCodecTest, TestChainedBody) | |
TEST (HTTP1xCodecTest, TestIgnoreUpstreamUpgrade) | |
TEST (HTTP1xCodecTest, WebsocketUpgrade) | |
TEST (HTTP1xCodecTest, WebsocketUpgradeKeyError) | |
TEST (HTTP1xCodecTest, WebsocketUpgradeHeaderSet) | |
TEST (HTTP1xCodecTest, WebsocketConnectionHeader) | |
TEST (HTTP1xCodecTest, TrailersAndEomAreNotGeneratedWhenNonChunked) | |
TEST_P (ConnectionHeaderTest, TestConnectionHeaders) | |
INSTANTIATE_TEST_CASE_P (HTTP1xCodec, ConnectionHeaderTest,::testing::Values(ConnectionHeaderTest::ParamType({"foo","bar","close","baz"},"foo, bar, baz, close"), ConnectionHeaderTest::ParamType({"foo","bar, close","baz"},"foo, bar, baz, close"), ConnectionHeaderTest::ParamType({" foo","bar, close "," baz "},"foo, bar, baz, close"), ConnectionHeaderTest::ParamType({"foo","bar, boo","baz"},"foo, bar, boo, baz, keep-alive"), ConnectionHeaderTest::ParamType({"foo","keep-alive, boo","close"},"foo, boo, close"), ConnectionHeaderTest::ParamType({"foo","upgrade, boo","baz"},"foo, upgrade, boo, baz, keep-alive"))) | |
unique_ptr<folly::IOBuf> getChunkedRequest1st | ( | ) |
Definition at line 214 of file HTTP1xCodecTest.cpp.
References folly::IOBuf::copyBuffer().
Referenced by TEST().
unique_ptr<folly::IOBuf> getChunkedRequest2nd | ( | ) |
Definition at line 219 of file HTTP1xCodecTest.cpp.
References folly::IOBuf::copyBuffer().
Referenced by TEST().
unique_ptr<folly::IOBuf> getSimpleRequestData | ( | ) |
Definition at line 66 of file HTTP1xCodecTest.cpp.
References folly::IOBuf::copyBuffer().
Referenced by TEST().
INSTANTIATE_TEST_CASE_P | ( | HTTP1xCodec | , |
ConnectionHeaderTest | , | ||
::testing::Values(ConnectionHeaderTest::ParamType({"foo","bar","close","baz"},"foo, bar, baz, close"), ConnectionHeaderTest::ParamType({"foo","bar, close","baz"},"foo, bar, baz, close"), ConnectionHeaderTest::ParamType({" foo","bar, close "," baz "},"foo, bar, baz, close"), ConnectionHeaderTest::ParamType({"foo","bar, boo","baz"},"foo, bar, boo, baz, keep-alive"), ConnectionHeaderTest::ParamType({"foo","keep-alive, boo","close"},"foo, boo, close"), ConnectionHeaderTest::ParamType({"foo","upgrade, boo","baz"},"foo, upgrade, boo, baz, keep-alive")) | |||
) |
TEST | ( | HTTP1xCodecTest | , |
TestSimpleHeaders | |||
) |
Definition at line 71 of file HTTP1xCodecTest.cpp.
References buffer(), codec, wangle::HTTPHeaderSize::compressed, proxygen::DOWNSTREAM, EXPECT_EQ, getSimpleRequestData(), HTTP1xCodecCallback::headersComplete, HTTP1xCodecCallback::headerSize, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), and wangle::HTTPHeaderSize::uncompressed.
TEST | ( | HTTP1xCodecTest | , |
Test09Req | |||
) |
Definition at line 82 of file HTTP1xCodecTest.cpp.
References buffer(), codec, wangle::HTTPHeaderSize::compressed, folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, EXPECT_EQ, HTTP1xCodecCallback::headersComplete, HTTP1xCodecCallback::headerSize, HTTP1xCodecCallback::messageComplete, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), and wangle::HTTPHeaderSize::uncompressed.
TEST | ( | HTTP1xCodecTest | , |
Test09ReqVers | |||
) |
Definition at line 98 of file HTTP1xCodecTest.cpp.
References buffer(), codec, wangle::HTTPHeaderSize::compressed, folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, EXPECT_EQ, HTTP1xCodecCallback::headersComplete, HTTP1xCodecCallback::headerSize, HTTP1xCodecCallback::messageComplete, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), and wangle::HTTPHeaderSize::uncompressed.
TEST | ( | HTTP1xCodecTest | , |
Test09Resp | |||
) |
Definition at line 110 of file HTTP1xCodecTest.cpp.
References HTTP1xCodecCallback::bodyLen, buffer(), codec, folly::IOBuf::copyBuffer(), proxygen::HTTP1xCodec::createStream(), EXPECT_EQ, proxygen::HTTP1xCodec::generateHeader(), proxygen::GET, HTTP1xCodecCallback::headersComplete, HTTP1xCodecCallback::messageComplete, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::onIngressEOF(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTPMessage::setHTTPVersion(), proxygen::HTTPMessage::setMethod(), proxygen::HTTPMessage::setURL(), and proxygen::UPSTREAM.
TEST | ( | HTTP1xCodecTest | , |
TestBadHeaders | |||
) |
Definition at line 131 of file HTTP1xCodecTest.cpp.
References testing::_, buffer(), codec, folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, folly::pushmi::operators::error(), EXPECT_CALL, EXPECT_EQ, testing::Invoke(), proxygen::HTTP1xCodec::onIngress(), and proxygen::HTTP1xCodec::setCallback().
TEST | ( | HTTP1xCodecTest | , |
TestHeadRequestChunkedResponse | |||
) |
Definition at line 148 of file HTTP1xCodecTest.cpp.
References folly::IOBufQueue::cacheChainLength(), codec, folly::IOBuf::copyBuffer(), proxygen::HTTP1xCodec::createStream(), proxygen::DOWNSTREAM, EXPECT_EQ, EXPECT_TRUE, proxygen::HTTP1xCodec::generateHeader(), proxygen::HTTPMessage::getHeaders(), HTTP1xCodecCallback::headersComplete, proxygen::HTTP_HEADER_TRANSFER_ENCODING, folly::IOBufQueue::move(), proxygen::HTTP1xCodec::onIngress(), proxygen::HTTPHeaders::set(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTPMessage::setHTTPVersion(), proxygen::HTTPMessage::setIsChunked(), and proxygen::HTTPMessage::setStatusCode().
TEST | ( | HTTP1xCodecTest | , |
TestGetRequestChunkedResponse | |||
) |
Definition at line 172 of file HTTP1xCodecTest.cpp.
References ASSERT_EQ, folly::IOBufQueue::cacheChainLength(), folly::IOBufQueue::chainLength(), codec, folly::IOBuf::copyBuffer(), proxygen::HTTP1xCodec::createStream(), proxygen::DOWNSTREAM, EXPECT_EQ, proxygen::HTTP1xCodec::generateBody(), proxygen::HTTP1xCodec::generateHeader(), proxygen::HTTPMessage::getHeaders(), HTTP1xCodecCallback::headersComplete, proxygen::HTTP_HEADER_TRANSFER_ENCODING, folly::gen::move, proxygen::HTTPCodec::NoPadding, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTPHeaders::set(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTPMessage::setHTTPVersion(), proxygen::HTTPMessage::setIsChunked(), proxygen::HTTPMessage::setStatusCode(), and folly::IOBufQueue::split().
TEST | ( | HTTP1xCodecTest | , |
TestChunkedHeaders | |||
) |
Definition at line 224 of file HTTP1xCodecTest.cpp.
References codec, proxygen::DOWNSTREAM, EXPECT_EQ, getChunkedRequest1st(), getChunkedRequest2nd(), HTTP1xCodecCallback::headersComplete, HTTP1xCodecCallback::headerSize, i, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), and wangle::HTTPHeaderSize::uncompressed.
TEST | ( | HTTP1xCodecTest | , |
TestChunkedUpstream | |||
) |
Definition at line 243 of file HTTP1xCodecTest.cpp.
References ASSERT_EQ, folly::IOBufQueue::cacheChainLength(), folly::IOBufQueue::chainLength(), codec, folly::IOBuf::copyBuffer(), proxygen::HTTP1xCodec::createStream(), proxygen::HTTP1xCodec::generateBody(), proxygen::HTTP1xCodec::generateHeader(), proxygen::HTTPMessage::getHeaders(), proxygen::HTTP_HEADER_HOST, proxygen::HTTP_HEADER_TRANSFER_ENCODING, folly::gen::move, proxygen::HTTPCodec::NoPadding, proxygen::HTTPHeaders::set(), proxygen::HTTPMessage::setHTTPVersion(), proxygen::HTTPMessage::setIsChunked(), proxygen::HTTPMessage::setURL(), folly::size(), folly::IOBufQueue::split(), and proxygen::UPSTREAM.
TEST | ( | HTTP1xCodecTest | , |
TestBadPost100 | |||
) |
Definition at line 281 of file HTTP1xCodecTest.cpp.
References testing::_, folly::IOBufQueue::cacheChainLength(), codec, folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, EXPECT_CALL, proxygen::HTTP1xCodec::generateEOM(), proxygen::HTTP1xCodec::generateHeader(), testing::InvokeWithoutArgs(), proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTP1xCodec::setParserPaused(), proxygen::HTTPMessage::setStatusCode(), proxygen::HTTPMessage::setStatusMessage(), and fizz::detail::writeBuf().
TEST | ( | HTTP1xCodecTest | , |
TestMultipleIdenticalContentLengthHeaders | |||
) |
Definition at line 327 of file HTTP1xCodecTest.cpp.
References folly::IOBufQueue::cacheChainLength(), codec, folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, EXPECT_EQ, proxygen::FakeHTTPCodecCallback::headersComplete, proxygen::FakeHTTPCodecCallback::messageBegin, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::FakeHTTPCodecCallback::streamErrors, and fizz::detail::writeBuf().
TEST | ( | HTTP1xCodecTest | , |
TestMultipleDistinctContentLengthHeaders | |||
) |
Definition at line 346 of file HTTP1xCodecTest.cpp.
References folly::IOBufQueue::cacheChainLength(), codec, folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, EXPECT_EQ, proxygen::FakeHTTPCodecCallback::headersComplete, proxygen::FakeHTTPCodecCallback::lastParseError, proxygen::FakeHTTPCodecCallback::messageBegin, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::FakeHTTPCodecCallback::streamErrors, and fizz::detail::writeBuf().
TEST | ( | HTTP1xCodecTest | , |
TestCorrectTransferEncodingHeader | |||
) |
Definition at line 365 of file HTTP1xCodecTest.cpp.
References folly::IOBufQueue::cacheChainLength(), folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, EXPECT_EQ, proxygen::FakeHTTPCodecCallback::headersComplete, proxygen::FakeHTTPCodecCallback::messageBegin, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::FakeHTTPCodecCallback::streamErrors, and fizz::detail::writeBuf().
TEST | ( | HTTP1xCodecTest | , |
TestFoldedTransferEncodingHeader | |||
) |
Definition at line 383 of file HTTP1xCodecTest.cpp.
References folly::IOBufQueue::cacheChainLength(), folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, EXPECT_EQ, proxygen::FakeHTTPCodecCallback::headersComplete, proxygen::FakeHTTPCodecCallback::lastParseError, proxygen::FakeHTTPCodecCallback::messageBegin, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::FakeHTTPCodecCallback::streamErrors, and fizz::detail::writeBuf().
TEST | ( | HTTP1xCodecTest | , |
TestBadTransferEncodingHeader | |||
) |
Definition at line 402 of file HTTP1xCodecTest.cpp.
References folly::IOBufQueue::cacheChainLength(), folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, EXPECT_EQ, proxygen::FakeHTTPCodecCallback::headersComplete, proxygen::FakeHTTPCodecCallback::lastParseError, proxygen::FakeHTTPCodecCallback::messageBegin, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::FakeHTTPCodecCallback::streamErrors, and fizz::detail::writeBuf().
TEST | ( | HTTP1xCodecTest | , |
Test1xxConnectionHeader | |||
) |
Definition at line 420 of file HTTP1xCodecTest.cpp.
References proxygen::HTTPHeaders::add(), folly::IOBufQueue::cacheChainLength(), proxygen::HTTP1xCodec::createStream(), proxygen::DOWNSTREAM, EXPECT_EQ, folly::IOBufQueue::front(), proxygen::HTTP1xCodec::generateHeader(), proxygen::HTTPMessage::getHeaders(), HTTP1xCodecCallback::headersComplete, proxygen::HTTP_HEADER_CONNECTION, proxygen::HTTP_HEADER_CONTENT_LENGTH, folly::IOBufQueue::move(), HTTP1xCodecCallback::msg_, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTPHeaders::remove(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTPMessage::setHTTPVersion(), proxygen::HTTPMessage::setStatusCode(), streamID, proxygen::UPSTREAM, and fizz::detail::writeBuf().
TEST | ( | HTTP1xCodecTest | , |
TestChainedBody | |||
) |
Definition at line 449 of file HTTP1xCodecTest.cpp.
References testing::_, folly::IOBufQueue::append(), codec, folly::IOBuf::copyBuffer(), proxygen::DOWNSTREAM, folly::IOBufQueue::empty(), EXPECT_TRUE, folly::IOBufQueue::front(), testing::Invoke(), ON_CALL, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), folly::IOBufQueue::trimStart(), and uint16_t.
TEST | ( | HTTP1xCodecTest | , |
TestIgnoreUpstreamUpgrade | |||
) |
Definition at line 478 of file HTTP1xCodecTest.cpp.
References proxygen::FakeHTTPCodecCallback::bodyLength, folly::IOBufQueue::cacheChainLength(), codec, folly::IOBuf::copyBuffer(), EXPECT_EQ, proxygen::FakeHTTPCodecCallback::headersComplete, proxygen::FakeHTTPCodecCallback::messageBegin, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::FakeHTTPCodecCallback::streamErrors, proxygen::UPSTREAM, and fizz::detail::writeBuf().
TEST | ( | HTTP1xCodecTest | , |
WebsocketUpgrade | |||
) |
Definition at line 498 of file HTTP1xCodecTest.cpp.
References folly::IOBufQueue::clear(), proxygen::HTTP1xCodec::createStream(), proxygen::DOWNSTREAM, proxygen::empty_string, EXPECT_EQ, EXPECT_NE, EXPECT_TRUE, folly::IOBufQueue::front(), proxygen::HTTP1xCodec::generateHeader(), HTTP1xCodecCallback::headersComplete, proxygen::HTTP_HEADER_SEC_WEBSOCKET_ACCEPT, proxygen::HTTP_HEADER_SEC_WEBSOCKET_KEY, HTTP1xCodecCallback::msg_, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTPMessage::setEgressWebsocketUpgrade(), proxygen::HTTPMessage::setHTTPVersion(), proxygen::HTTPMessage::setStatusCode(), proxygen::HTTPMessage::setURL(), streamID, and proxygen::UPSTREAM.
TEST | ( | HTTP1xCodecTest | , |
WebsocketUpgradeKeyError | |||
) |
Definition at line 535 of file HTTP1xCodecTest.cpp.
References codec, folly::IOBuf::copyBuffer(), proxygen::HTTP1xCodec::createStream(), HTTP1xCodecCallback::errors, EXPECT_EQ, proxygen::HTTP1xCodec::generateHeader(), HTTP1xCodecCallback::headersComplete, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTPMessage::setEgressWebsocketUpgrade(), proxygen::HTTPMessage::setHTTPVersion(), proxygen::HTTPMessage::setURL(), streamID, and proxygen::UPSTREAM.
TEST | ( | HTTP1xCodecTest | , |
WebsocketUpgradeHeaderSet | |||
) |
Definition at line 558 of file HTTP1xCodecTest.cpp.
References proxygen::HTTPHeaders::add(), proxygen::HTTP1xCodec::createStream(), proxygen::DOWNSTREAM, proxygen::empty_string, EXPECT_EQ, folly::IOBufQueue::front(), proxygen::HTTP1xCodec::generateHeader(), proxygen::GET, proxygen::HTTPMessage::getHeaders(), proxygen::HTTP_HEADER_SEC_WEBSOCKET_KEY, proxygen::HTTP_HEADER_UPGRADE, HTTP1xCodecCallback::msg_, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTPMessage::setEgressWebsocketUpgrade(), proxygen::HTTPMessage::setMethod(), proxygen::HTTPMessage::setURL(), and proxygen::UPSTREAM.
TEST | ( | HTTP1xCodecTest | , |
WebsocketConnectionHeader | |||
) |
Definition at line 578 of file HTTP1xCodecTest.cpp.
References proxygen::HTTPHeaders::add(), proxygen::HTTP1xCodec::createStream(), proxygen::Base64::decode(), proxygen::DOWNSTREAM, proxygen::empty_string, EXPECT_EQ, EXPECT_NE, EXPECT_NO_THROW, folly::IOBufQueue::front(), proxygen::HTTP1xCodec::generateHeader(), proxygen::GET, proxygen::HTTPMessage::getHeaders(), proxygen::HTTP_HEADER_CONNECTION, proxygen::HTTP_HEADER_SEC_WEBSOCKET_ACCEPT, proxygen::HTTP_HEADER_SEC_WEBSOCKET_KEY, HTTP1xCodecCallback::msg_, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTPMessage::setEgressWebsocketUpgrade(), proxygen::HTTPMessage::setMethod(), proxygen::HTTPMessage::setURL(), and proxygen::UPSTREAM.
TEST | ( | HTTP1xCodecTest | , |
TrailersAndEomAreNotGeneratedWhenNonChunked | |||
) |
Definition at line 614 of file HTTP1xCodecTest.cpp.
References proxygen::HTTPHeaders::add(), codec, proxygen::HTTP1xCodec::createStream(), EXPECT_EQ, proxygen::HTTP1xCodec::generateEOM(), proxygen::HTTP1xCodec::generateHeader(), proxygen::HTTP1xCodec::generateTrailers(), proxygen::HTTPMessage::getHeaders(), proxygen::HTTP_HEADER_HOST, proxygen::HTTPHeaders::set(), proxygen::HTTPMessage::setHTTPVersion(), proxygen::HTTPMessage::setIsChunked(), proxygen::HTTPMessage::setURL(), and proxygen::UPSTREAM.
TEST_P | ( | ConnectionHeaderTest | , |
TestConnectionHeaders | |||
) |
Definition at line 645 of file HTTP1xCodecTest.cpp.
References proxygen::HTTPHeaders::add(), folly::IOBufQueue::cacheChainLength(), proxygen::HTTP1xCodec::createStream(), proxygen::DOWNSTREAM, EXPECT_EQ, folly::IOBufQueue::front(), proxygen::HTTP1xCodec::generateHeader(), proxygen::GET, proxygen::HTTPMessage::getHeaders(), HTTP1xCodecCallback::headersComplete, proxygen::HTTP_HEADER_CONNECTION, proxygen::INSTANTIATE_TEST_CASE_P(), HTTP1xCodecCallback::msg_, proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::setCallback(), proxygen::HTTPMessage::setMethod(), proxygen::HTTPMessage::setURL(), proxygen::UPSTREAM, val, and fizz::detail::writeBuf().