Skip to content

Commit 180d1c8

Browse files
hanidamlajfacebook-github-bot
authored andcommitted
HTTP1xCodec remove unreachable code
Summary: * continuining efforts to clean up the codebase and deprecating http/1.1 -> http/2 plaintext upgrades * removing unreachable code in HTTP1xCodec since we no longer support plaintext upgrades Reviewed By: lnicco Differential Revision: D78755025 fbshipit-source-id: 1290a55b9e87f4ceff0097d947120aa64a34028f
1 parent 74f1173 commit 180d1c8

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

proxygen/lib/http/codec/HTTP1xCodec.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ HTTP1xCodec::HTTP1xCodec(TransportDirection direction,
113113
ingressUpgrade_(false),
114114
ingressUpgradeComplete_(false),
115115
egressUpgrade_(false),
116-
nativeUpgrade_(false),
117116
headersComplete_(false),
118117
releaseEgressAfterRequest_(false) {
119118
switch (direction) {
@@ -1235,22 +1234,11 @@ int HTTP1xCodec::onMessageComplete() {
12351234
switch (transportDirection_) {
12361235
case TransportDirection::DOWNSTREAM: {
12371236
requestPending_ = false;
1238-
if (upgradeRequest_) {
1239-
ingressUpgrade_ =
1240-
callback_->onNativeProtocolUpgrade(ingressTxnID_,
1241-
upgradeResult_.first,
1242-
upgradeResult_.second,
1243-
*upgradeRequest_);
1244-
upgradeRequest_.reset();
1245-
}
1246-
// else there was no match, OR we upgraded to http/1.1 OR someone
1247-
// specified a non-native protocol in the setAllowedUpgradeProtocols.
1248-
// No-ops
12491237
break;
12501238
}
12511239
case TransportDirection::UPSTREAM:
12521240
responsePending_ = is1xxResponse_;
1253-
if (is1xxResponse_ && !nativeUpgrade_ && !ingressUpgrade_) {
1241+
if (is1xxResponse_ && !ingressUpgrade_) {
12541242
// Some other 1xx status code, which doesn't terminate the message
12551243
return 0;
12561244
}
@@ -1259,12 +1247,8 @@ int HTTP1xCodec::onMessageComplete() {
12591247
// For downstream, always call onMessageComplete. If native upgrade,
12601248
// pass upgrade=false. Else pass ingressUpgrade_.
12611249
// For upstream, call onMessagComplete if not native upgrade.
1262-
if (!nativeUpgrade_) {
1263-
callback_->onMessageComplete(ingressTxnID_, ingressUpgrade_);
1264-
} else if (transportDirection_ == TransportDirection::DOWNSTREAM) {
1265-
// native upgrade and downstream.
1266-
callback_->onMessageComplete(ingressTxnID_, false);
1267-
}
1250+
callback_->onMessageComplete(ingressTxnID_, ingressUpgrade_);
1251+
12681252
// else we suppressed onHeadersComplete, suppress onMessageComplete also.
12691253
// The new codec will handle these callbacks with the real message
12701254

proxygen/lib/http/codec/HTTP1xCodec.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ class HTTP1xCodec : public HTTPCodec {
209209
http_parser parser_;
210210
const folly::IOBuf* currentIngressBuf_;
211211
std::unique_ptr<HTTPMessage> msg_;
212-
std::unique_ptr<HTTPMessage> upgradeRequest_;
213212
std::unique_ptr<HTTPHeaders> trailers_;
214213
std::string currentHeaderName_;
215214
folly::StringPiece currentHeaderNameStringPiece_;

0 commit comments

Comments
 (0)