本文整理汇总了C++中HTTPMessage::setHTTP2Priority方法的典型用法代码示例。如果您正苦于以下问题:C++ HTTPMessage::setHTTP2Priority方法的具体用法?C++ HTTPMessage::setHTTP2Priority怎么用?C++ HTTPMessage::setHTTP2Priority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPMessage
的用法示例。
在下文中一共展示了HTTPMessage::setHTTP2Priority方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getGetRequest
TEST_F(HTTP2CodecTest, BadHeaderPriority) {
HTTPMessage req = getGetRequest();
req.setHTTP2Priority(HTTPMessage::HTTPPriority(0, false, 7));
upstreamCodec_.generateHeader(output_, 1, req, 0, true /* eom */);
// hack ingress with cirular dep
EXPECT_TRUE(parse([&] (IOBuf* ingress) {
folly::io::RWPrivateCursor c(ingress);
c.skip(http2::kFrameHeaderSize + http2::kConnectionPreface.length());
c.writeBE<uint32_t>(1);
}));
EXPECT_EQ(callbacks_.streamErrors, 1);
EXPECT_EQ(callbacks_.sessionErrors, 0);
}
示例2: bigval
TEST_F(HTTP2CodecTest, Normal1024Continuation) {
HTTPMessage req = getGetRequest();
string bigval(8691, '!');
bigval.append(8691, ' ');
req.getHeaders().add("x-headr", bigval);
req.setHTTP2Priority(HTTPMessage::HTTPPriority(0, false, 7));
upstreamCodec_.generateHeader(output_, 1, req, 0);
parse();
callbacks_.expectMessage(false, -1, "/");
const auto& headers = callbacks_.msg->getHeaders();
EXPECT_EQ(bigval, headers.getSingleOrEmpty("x-headr"));
EXPECT_EQ(callbacks_.messageBegin, 1);
EXPECT_EQ(callbacks_.headersComplete, 1);
EXPECT_EQ(callbacks_.messageComplete, 0);
EXPECT_EQ(callbacks_.streamErrors, 0);
EXPECT_EQ(callbacks_.sessionErrors, 0);
upstreamCodec_.generateSettingsAck(output_);
parse();
EXPECT_EQ(callbacks_.settingsAcks, 1);
}