mirror of
https://github.com/facebook/proxygen.git
synced 2025-04-20 14:09:47 +08:00
invoke ::generateEOM from ::generateTrailers
Summary: ::generateTrailers is a terminal "event" on a http1x chunked upstream req / downstream resp Put another way – after invoking ::generateTrailers, nothing else can be egressed w.r.t. to the txn; this is enforced by HTTPTransactionEgressSM Reviewed By: jbeshay, kvtsoy Differential Revision: D70193047 fbshipit-source-id: 1d19fc86496d4fb06ed1bd0e493a22b12b2f355c
This commit is contained in:
parent
bbfe19d8a4
commit
788029d7a1
@ -789,6 +789,7 @@ size_t HTTP1xCodec::generateTrailers(IOBufQueue& writeBuf,
|
||||
appendString(writeBuf, len, value);
|
||||
appendLiteral(writeBuf, len, CRLF);
|
||||
});
|
||||
len += generateEOM(writeBuf, txn);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@ -804,10 +805,7 @@ size_t HTTP1xCodec::generateEOM(IOBufQueue& writeBuf, StreamID txn) {
|
||||
// appending a 0\r\n only if it's not a HEAD and downstream request
|
||||
if (!lastChunkWritten_) {
|
||||
lastChunkWritten_ = true;
|
||||
if (!(headRequest_ &&
|
||||
transportDirection_ == TransportDirection::DOWNSTREAM)) {
|
||||
appendLiteral(writeBuf, len, "0\r\n");
|
||||
}
|
||||
appendLiteral(writeBuf, len, "0\r\n");
|
||||
}
|
||||
appendLiteral(writeBuf, len, CRLF);
|
||||
}
|
||||
|
@ -873,7 +873,6 @@ TEST(HTTP1xCodecTest, TestChunkResponseSerialization) {
|
||||
downCodec.generateBody(
|
||||
blob, downStream, body->clone(), HTTPCodec::NoPadding, false);
|
||||
downCodec.generateTrailers(blob, downStream, trailers);
|
||||
downCodec.generateEOM(blob, downStream);
|
||||
|
||||
std::string tmp;
|
||||
blob.appendToString(tmp);
|
||||
|
@ -1846,13 +1846,8 @@ size_t HTTPSession::sendEOM(HTTPTransaction* txn,
|
||||
size_t encodedSize = 0;
|
||||
if (trailers) {
|
||||
encodedSize = codec_->generateTrailers(writeBuf_, txn->getID(), *trailers);
|
||||
}
|
||||
|
||||
// Don't send EOM for HTTP2, when trailers sent.
|
||||
// sendTrailers already flagged end of stream.
|
||||
bool http2Trailers = trailers && isHTTP2CodecProtocol(codec_->getProtocol());
|
||||
if (!http2Trailers) {
|
||||
encodedSize += codec_->generateEOM(writeBuf_, txn->getID());
|
||||
} else {
|
||||
encodedSize = codec_->generateEOM(writeBuf_, txn->getID());
|
||||
}
|
||||
|
||||
commonEom(txn, encodedSize, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user