proxygen
HTTPTransaction.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
12 #include <boost/heap/d_ary_heap.hpp>
13 #include <climits>
14 #include <folly/Optional.h>
15 #include <folly/SocketAddress.h>
19 #include <iosfwd>
33 #include <set>
34 
35 namespace proxygen {
36 
93  public:
95 
97  std::chrono::milliseconds ttfb,
98  std::chrono::milliseconds ttlb,
99  uint64_t eHeader,
100  uint64_t inHeader,
101  uint64_t eBody,
102  uint64_t inBody,
103  bool completed):
104  timeToFirstByte(ttfb),
105  timeToLastByte(ttlb),
106  egressHeaderBytes(eHeader),
107  ingressHeaderBytes(inHeader),
108  egressBodyBytes(eBody),
109  ingressBodyBytes(inBody),
110  isCompleted(completed) {
111  }
112 
114  std::chrono::milliseconds timeToFirstByte{0};
116  std::chrono::milliseconds timeToLastByte{0};
117 
126 
128  bool isCompleted{false};
129 };
130 
131 class HTTPSessionStats;
132 class HTTPTransaction;
134  public:
135 
140  virtual void setTransaction(HTTPTransaction* txn) noexcept = 0;
141 
149  virtual void detachTransaction() noexcept = 0;
150 
157  virtual void onHeadersComplete(std::unique_ptr<HTTPMessage> msg) noexcept = 0;
158 
164  virtual void onBody(std::unique_ptr<folly::IOBuf> chain) noexcept = 0;
165 
173  virtual void onChunkHeader(size_t /* length */) noexcept {}
174 
180  virtual void onChunkComplete() noexcept {}
181 
189  virtual void onTrailers(std::unique_ptr<HTTPHeaders> trailers) noexcept
190  = 0;
191 
202  virtual void onEOM() noexcept = 0;
203 
212  virtual void onUpgrade(UpgradeProtocol protocol) noexcept = 0;
213 
220  virtual void onError(const HTTPException& error) noexcept = 0;
221 
226  virtual void onEgressPaused() noexcept = 0;
227 
232  virtual void onEgressResumed() noexcept = 0;
233 
241  virtual void onPushedTransaction(HTTPTransaction* /* txn */) noexcept {}
242 
247  virtual void onExTransaction(HTTPTransaction* /* txn */) noexcept {}
248 
256  virtual void onGoaway(ErrorCode /* code */) noexcept {}
257 
259 };
260 
262  public:
264 
265  void onHeadersComplete(std::unique_ptr<HTTPMessage>) noexcept final {
266  LOG(FATAL) << "push txn received headers";
267  }
268 
269  void onBody(std::unique_ptr<folly::IOBuf>) noexcept final {
270  LOG(FATAL) << "push txn received body";
271  }
272 
273  void onChunkHeader(size_t /* length */) noexcept final {
274  LOG(FATAL) << "push txn received chunk header";
275  }
276 
277  void onChunkComplete() noexcept final {
278  LOG(FATAL) << "push txn received chunk complete";
279  }
280 
281  void onTrailers(std::unique_ptr<HTTPHeaders>) noexcept final {
282  LOG(FATAL) << "push txn received trailers";
283  }
284 
285  void onEOM() noexcept final {
286  LOG(FATAL) << "push txn received EOM";
287  }
288 
290  LOG(FATAL) << "push txn received upgrade";
291  }
292 
294  LOG(FATAL) << "push txn received push txn";
295  }
296 };
297 
302  public:
303  virtual void firstHeaderByteFlushed() noexcept = 0;
304 
305  virtual void firstByteFlushed() noexcept = 0;
306 
307  virtual void lastByteFlushed() noexcept = 0;
308 
309  virtual void trackedByteFlushed() noexcept {}
310 
311  virtual void lastByteAcked(std::chrono::milliseconds latency) noexcept = 0;
312 
313  virtual void headerBytesGenerated(HTTPHeaderSize& size) noexcept = 0;
314 
315  virtual void headerBytesReceived(const HTTPHeaderSize& size) noexcept = 0;
316 
317  virtual void bodyBytesGenerated(size_t nbytes) noexcept = 0;
318 
319  virtual void bodyBytesReceived(size_t size) noexcept = 0;
320 
322 };
323 
327  public:
330 
331  class Transport {
332  public:
333  virtual ~Transport() {}
334 
335  virtual void pauseIngress(HTTPTransaction* txn) noexcept = 0;
336 
337  virtual void resumeIngress(HTTPTransaction* txn) noexcept = 0;
338 
339  virtual void transactionTimeout(HTTPTransaction* txn) noexcept = 0;
340 
341  virtual void sendHeaders(HTTPTransaction* txn,
342  const HTTPMessage& headers,
344  bool eom) noexcept = 0;
345 
346  virtual size_t sendBody(HTTPTransaction* txn,
347  std::unique_ptr<folly::IOBuf>,
348  bool eom,
349  bool trackLastByteFlushed) noexcept = 0;
350 
351  virtual size_t sendChunkHeader(HTTPTransaction* txn,
352  size_t length) noexcept = 0;
353 
354  virtual size_t sendChunkTerminator(HTTPTransaction* txn) noexcept = 0;
355 
356  virtual size_t sendEOM(HTTPTransaction* txn,
357  const HTTPHeaders* trailers) noexcept = 0;
358 
359  virtual size_t sendAbort(HTTPTransaction* txn,
360  ErrorCode statusCode) noexcept = 0;
361 
362  virtual size_t sendPriority(HTTPTransaction* txn,
363  const http2::PriorityUpdate& pri) noexcept = 0;
364 
365  virtual size_t sendWindowUpdate(HTTPTransaction* txn,
366  uint32_t bytes) noexcept = 0;
367 
368  virtual void notifyPendingEgress() noexcept = 0;
369 
370  virtual void detach(HTTPTransaction* txn) noexcept = 0;
371 
372  virtual void notifyIngressBodyProcessed(uint32_t bytes) noexcept = 0;
373 
374  virtual void notifyEgressBodyBuffered(int64_t bytes) noexcept = 0;
375 
376  virtual const folly::SocketAddress& getLocalAddress()
377  const noexcept = 0;
378 
379  virtual const folly::SocketAddress& getPeerAddress()
380  const noexcept = 0;
381 
382  virtual void describe(std::ostream&) const = 0;
383 
384  virtual const wangle::TransportInfo& getSetupTransportInfo() const noexcept = 0;
385 
386  virtual bool getCurrentTransportInfo(wangle::TransportInfo* tinfo) = 0;
387 
388  virtual const HTTPCodec& getCodec() const noexcept = 0;
389 
390  /*
391  * Drain the underlying session. This will affect other transactions
392  * running on the same session and is discouraged unless you are confident
393  * that the session is broken.
394  */
395  virtual void drain() = 0;
396 
397  virtual bool isDraining() const = 0;
398 
399  virtual HTTPTransaction* newPushedTransaction(
400  HTTPCodec::StreamID assocStreamId,
401  HTTPTransaction::PushHandler* handler) noexcept = 0;
402 
403  virtual HTTPTransaction* newExTransaction(
404  HTTPTransaction::Handler* handler,
405  HTTPCodec::StreamID controlStream,
406  bool unidirectional) noexcept = 0;
407 
408  virtual std::string getSecurityProtocol() const = 0;
409 
410  virtual void addWaitingForReplaySafety(
411  folly::AsyncTransport::ReplaySafetyCallback* callback) noexcept = 0;
412 
413  virtual void removeWaitingForReplaySafety(
414  folly::AsyncTransport::ReplaySafetyCallback* callback) noexcept = 0;
415 
416  virtual bool needToBlockForReplaySafety() const = 0;
417 
418  virtual const folly::AsyncTransportWrapper* getUnderlyingTransport()
419  const noexcept = 0;
420 
424  virtual bool isReplaySafe() const = 0;
425 
426  virtual void setHTTP2PrioritiesEnabled(bool enabled) = 0;
427  virtual bool getHTTP2PrioritiesEnabled() const = 0;
428 
430  getHTTPPriority(uint8_t level) = 0;
431  };
432 
434 
446  uint32_t seqNo,
447  Transport& transport,
448  HTTP2PriorityQueueBase& egressQueue,
449  folly::HHWheelTimer* timer = nullptr,
452  HTTPSessionStats* stats = nullptr,
453  bool useFlowControl = false,
454  uint32_t receiveInitialWindowSize = 0,
455  uint32_t sendInitialWindowSize = 0,
461 
462  ~HTTPTransaction() override;
463 
464  void reset(bool useFlowControl,
465  uint32_t receiveInitialWindowSize,
466  uint32_t receiveStreamWindowSize,
467  uint32_t sendInitialWindowSize);
468 
469  HTTPCodec::StreamID getID() const { return id_; }
470 
471  uint32_t getSequenceNumber() const { return seqNo_; }
472 
473  const Transport& getTransport() const { return transport_; }
474 
476 
477  virtual void setHandler(Handler* handler) {
478  handler_ = handler;
479  if (handler_) {
480  handler_->setTransaction(this);
481  }
482  }
483 
484  const Handler* getHandler() const {
485  return handler_;
486  }
487 
489  return priority_;
490  }
491 
492  std::tuple<uint64_t, uint64_t, double> getPrioritySummary() const {
493  return std::make_tuple(
494  insertDepth_,
495  currentDepth_,
496  egressCalls_ > 0 ? cumulativeRatio_ / egressCalls_ : 0);
497  }
498 
499  bool getPriorityFallback() const {
500  return priorityFallback_;
501  }
502 
504  return egressState_;
505  }
506 
508  return ingressState_;
509  }
510 
511  bool isUpstream() const {
512  return direction_ == TransportDirection::UPSTREAM;
513  }
514 
515  bool isDownstream() const {
516  return direction_ == TransportDirection::DOWNSTREAM;
517  }
518 
520  addr = transport_.getLocalAddress();
521  }
522 
524  addr = transport_.getPeerAddress();
525  }
526 
528  const noexcept {
529  return transport_.getLocalAddress();
530  }
531 
533  const noexcept {
534  return transport_.getPeerAddress();
535  }
536 
538  return transport_.getSetupTransportInfo();
539  }
540 
542  transport_.getCurrentTransportInfo(tinfo);
543  }
544 
546  return stats_;
547  }
548 
554  virtual bool extraResponseExpected() const {
555  return (lastResponseStatus_ >= 100 && lastResponseStatus_ < 200)
556  && lastResponseStatus_ != 101;
557  }
558 
567  virtual void setReceiveWindow(uint32_t capacity);
568 
572  virtual const Window& getReceiveWindow() const {
573  return recvWindow_;
574  }
575 
577  return maxDeferredIngress_;
578  }
579 
583  void onIngressHeadersComplete(std::unique_ptr<HTTPMessage> msg);
584 
589  void onIngressBody(std::unique_ptr<folly::IOBuf> chain, uint16_t padding);
590 
594  void onIngressChunkHeader(size_t length);
595 
599  void onIngressChunkComplete();
600 
604  void onIngressTrailers(std::unique_ptr<HTTPHeaders> trailers);
605 
610  void onIngressUpgrade(UpgradeProtocol protocol);
611 
615  void onIngressEOM();
616 
627  void onError(const HTTPException& error);
628 
636  void onGoaway(ErrorCode code);
637 
643  void onIngressTimeout();
644 
650  void onIngressWindowUpdate(uint32_t amount);
651 
657  void onIngressSetSendWindow(uint32_t newWindowSize);
658 
663  bool onWriteReady(uint32_t maxEgress, double ratio);
664 
668  void onEgressTimeout();
669 
673  void onEgressHeaderFirstByte();
674 
678  void onEgressBodyFirstByte();
679 
683  void onEgressBodyLastByte();
684 
688  void onEgressTrackedByte();
689 
696  void onEgressLastByteAck(std::chrono::milliseconds latency);
697 
703  transportCallback_ = cb;
704  }
705 
709  bool isIngressStarted() const {
710  return ingressState_ != HTTPTransactionIngressSM::State::Start;
711  }
712 
717  bool isIngressEOMQueued() const {
718  return ingressState_ == HTTPTransactionIngressSM::State::EOMQueued;
719  }
720 
724  bool isIngressComplete() const {
725  return ingressState_ == HTTPTransactionIngressSM::State::ReceivingDone;
726  }
727 
731  bool isIngressEOMSeen() const {
732  return isIngressEOMQueued() || isIngressComplete();
733  }
734 
738  bool isEgressStarted() const {
739  return egressState_ != HTTPTransactionEgressSM::State::Start;
740  }
741 
746  bool isEgressEOMQueued() const {
747  return egressState_ == HTTPTransactionEgressSM::State::EOMQueued;
748  }
749 
753  bool isEgressComplete() const {
754  return egressState_ == HTTPTransactionEgressSM::State::SendingDone;
755  }
756 
760  bool isRemoteInitiated() const {
761  return (direction_ == TransportDirection::DOWNSTREAM && id_ % 2 == 1) ||
762  (direction_ == TransportDirection::UPSTREAM && id_ % 2 == 0);
763  }
764 
768  bool isEgressEOMSeen() const {
769  return isEgressEOMQueued() || isEgressComplete();
770  }
771 
781  virtual bool canSendHeaders() const {
783  egressState_,
784  HTTPTransactionEgressSM::Event::sendHeaders)
785  && (isUpstream() || lastResponseStatus_ == 0 || extraResponseExpected());
786  }
787 
800  virtual void sendHeaders(const HTTPMessage& headers);
801  virtual void sendHeadersWithEOM(const HTTPMessage& headers);
802  virtual void sendHeadersWithOptionalEOM(const HTTPMessage& headers, bool eom);
803 
816  virtual void sendBody(std::unique_ptr<folly::IOBuf> body);
817 
825  virtual void sendChunkHeader(size_t length) {
827  egressState_, HTTPTransactionEgressSM::Event::sendChunkHeader));
828  // TODO: move this logic down to session/codec
829  if (!transport_.getCodec().supportsParallelRequests()) {
830  chunkHeaders_.emplace_back(Chunk(length));
831  }
832  }
833 
840  virtual void sendChunkTerminator() {
842  egressState_, HTTPTransactionEgressSM::Event::sendChunkTerminator));
843  }
844 
853  virtual void sendTrailers(const HTTPHeaders& trailers) {
855  egressState_, HTTPTransactionEgressSM::Event::sendTrailers));
856  trailers_.reset(new HTTPHeaders(trailers));
857  }
858 
873  virtual void sendEOM();
874 
884  virtual void sendAbort();
885 
895  virtual void pauseIngress();
896 
900  virtual void resumeIngress();
901 
905  bool isIngressPaused() const { return ingressPaused_; }
906 
919  void pauseEgress();
920 
928  void resumeEgress();
929 
936  void setEgressRateLimit(uint64_t bitsPerSecond);
937 
941  bool isEgressPaused() const { return handlerEgressPaused_; }
942 
947  bool isFlowControlPaused() const { return flowControlPaused_; }
948 
954  return direction_ == TransportDirection::DOWNSTREAM &&
955  transport_.getCodec().supportsPushTransactions();
956  }
957 
967  if (isEgressEOMSeen()) {
968  return nullptr;
969  }
970  auto txn = transport_.newPushedTransaction(id_, handler);
971  if (txn) {
972  pushedTransactions_.insert(txn->getID());
973  }
974  return txn;
975  }
976 
985  bool unidirectional = false) {
986  auto txn = transport_.newExTransaction(handler, id_, unidirectional);
987  if (txn) {
988  exTransactions_.insert(txn->getID());
989  }
990  return txn;
991  }
992 
999  bool onPushedTransaction(HTTPTransaction* txn);
1000 
1006  bool onExTransaction(HTTPTransaction* txn);
1007 
1011  bool isPushed() const {
1012  return assocStreamId_.has_value();
1013  }
1014 
1015  bool isExTransaction() const {
1016  return exAttributes_.has_value();
1017  }
1018 
1019  bool isUnidirectional() const {
1020  return isExTransaction() && exAttributes_->unidirectional;
1021  }
1022 
1028  void setIdleTimeout(std::chrono::milliseconds transactionTimeout);
1029 
1033  bool hasIdleTimeout() const {
1034  return transactionTimeout_.hasValue();
1035  }
1036 
1041  std::chrono::milliseconds getIdleTimeout() const {
1042  return transactionTimeout_.value();
1043  }
1044 
1049  return assocStreamId_;
1050  }
1051 
1057  return exAttributes_ ? exAttributes_->controlStream : HTTPCodec::NoStream;
1058  }
1059 
1060 
1061  /*
1062  * Returns attributes of EX stream (folly::none if not an EX transaction)
1063  */
1065  return exAttributes_;
1066  }
1067 
1071  const std::set<HTTPCodec::StreamID>& getPushedTransactions() const {
1072  return pushedTransactions_;
1073  }
1074 
1078  std::set<HTTPCodec::StreamID> getExTransactions() const {
1079  return exTransactions_;
1080  }
1081 
1087  pushedTransactions_.erase(pushStreamId);
1088  }
1089 
1094  exTransactions_.erase(exStreamId);
1095  }
1096 
1101  if (timer_ && hasIdleTimeout()) {
1102  timer_->scheduleTimeout(this, transactionTimeout_.value());
1103  }
1104  }
1105 
1111  bool ret = firstByteSent_;
1112  firstByteSent_ = true;
1113  return ret;
1114  }
1115 
1117  bool ret = inActiveSet_;
1118  inActiveSet_ = false;
1119  return ret;
1120  }
1121 
1127  bool ret = firstHeaderByteSent_;
1128  firstHeaderByteSent_ = true;
1129  return ret;
1130  }
1131 
1138  CHECK_LT(pendingByteEvents_, std::numeric_limits<uint8_t>::max());
1139  pendingByteEvents_++;
1140  }
1141 
1143  DestructorGuard dg(this);
1144  CHECK_GT(pendingByteEvents_, 0);
1145  pendingByteEvents_--;
1146  }
1147 
1152  void timeoutExpired() noexcept override {
1153  transport_.transactionTimeout(this);
1154  }
1155 
1159  void describe(std::ostream& os) const;
1160 
1164  void updateAndSendPriority(int8_t newPriority);
1165  void updateAndSendPriority(const http2::PriorityUpdate& pri);
1166 
1170  void onPriorityUpdate(const http2::PriorityUpdate& priority);
1171 
1178  transport_.addWaitingForReplaySafety(callback);
1179  }
1180 
1186  transport_.removeWaitingForReplaySafety(callback);
1187  }
1188 
1189  virtual bool needToBlockForReplaySafety() const {
1190  return transport_.needToBlockForReplaySafety();
1191  }
1192 
1193  int32_t getRecvToAck() const;
1194 
1195  bool isPrioritySampled() const {
1196  return prioritySample_ != nullptr;
1197  }
1198 
1199  void setPrioritySampled(bool sampled);
1200  void updateContentionsCount(uint64_t contentions);
1201  void updateRelativeWeight(double ratio);
1202  void updateSessionBytesSheduled(uint64_t bytes);
1203  void updateTransactionBytesSent(uint64_t bytes);
1204 
1207  double byTransactionBytes_{0};
1208  double bySessionBytes_{0};
1209  };
1214  };
1215 
1216  bool getPrioritySampleSummary(PrioritySampleSummary& summary) const;
1217 
1218  HPACKTableInfo& getHPACKTableInfo();
1219 
1220  bool hasPendingBody() const {
1221  return deferredEgressBody_.chainLength() > 0;
1222  }
1223 
1225  enableLastByteFlushedTracking_ = enabled;
1226  }
1227 
1228  private:
1229  HTTPTransaction(const HTTPTransaction&) = delete;
1230  HTTPTransaction& operator=(const HTTPTransaction&) = delete;
1231 
1232  void onDelayedDestroy(bool delayed) override;
1233 
1238  void updateHandlerPauseState();
1239 
1243  void updateEgressHPACKTableInfo(HPACKTableInfo);
1244 
1245  void updateIngressHPACKTableInfo(HPACKTableInfo);
1246 
1247  bool mustQueueIngress() const;
1248 
1253  void checkCreateDeferredIngress();
1254 
1258  void sendAbort(ErrorCode statusCode);
1259 
1260  // Internal implementations of the ingress-related callbacks
1261  // that work whether the ingress events are immediate or deferred.
1262  void processIngressHeadersComplete(std::unique_ptr<HTTPMessage> msg);
1263  void processIngressBody(std::unique_ptr<folly::IOBuf> chain, size_t len);
1264  void processIngressChunkHeader(size_t length);
1265  void processIngressChunkComplete();
1266  void processIngressTrailers(std::unique_ptr<HTTPHeaders> trailers);
1267  void processIngressUpgrade(UpgradeProtocol protocol);
1268  void processIngressEOM();
1269 
1270  void sendBodyFlowControlled(std::unique_ptr<folly::IOBuf> body = nullptr);
1271  size_t sendBodyNow(std::unique_ptr<folly::IOBuf> body, size_t bodyLen,
1272  bool eom);
1273  size_t sendEOMNow();
1274  void onDeltaSendWindowSize(int32_t windowDelta);
1275 
1276  void notifyTransportPendingEgress();
1277 
1278  size_t sendDeferredBody(uint32_t maxEgress);
1279 
1280  bool maybeDelayForRateLimit();
1281 
1282  bool isEnqueued() const { return queueHandle_->isEnqueued(); }
1283 
1284  void dequeue() {
1285  DCHECK(isEnqueued());
1286  egressQueue_.clearPendingEgress(queueHandle_);
1287  }
1288 
1289  bool hasPendingEOM() const {
1290  return deferredEgressBody_.chainLength() == 0 &&
1291  isEgressEOMQueued();
1292  }
1293 
1294  bool isExpectingIngress() const;
1295 
1296  bool isExpectingWindowUpdate() const;
1297 
1298  void updateReadTimeout();
1299 
1304  void markIngressComplete();
1305 
1310  void markEgressComplete();
1311 
1317  bool validateIngressStateTransition(HTTPTransactionIngressSM::Event);
1318 
1323  void flushWindowUpdate();
1324 
1325  void rateLimitTimeoutExpired();
1326 
1328  public:
1330  : txn_(txn) {}
1331 
1332  void timeoutExpired() noexcept override {
1333  txn_.rateLimitTimeoutExpired();
1334  }
1335  void callbackCanceled() noexcept override {
1336  // no op
1337  }
1338  private:
1340  };
1341 
1342  RateLimitCallback rateLimitCallback_{*this};
1343 
1348  std::unique_ptr<std::queue<HTTPEvent>> deferredIngress_;
1349 
1350  uint32_t maxDeferredIngress_{0};
1351 
1357 
1361  Handler* handler_{nullptr};
1367 
1368  HTTPSessionStats* stats_{nullptr};
1369 
1371 
1377 
1383 
1384  TransportCallback* transportCallback_{nullptr};
1385 
1389  std::unique_ptr<HTTPHeaders> trailers_;
1390 
1391  struct Chunk {
1392  explicit Chunk(size_t inLength) : length(inLength), headerSent(false) {}
1393  size_t length;
1395  };
1396  std::list<Chunk> chunkHeaders_;
1397 
1402 
1407 
1411  int32_t recvToAck_{0};
1412 
1417 
1422 
1426  std::set<HTTPCodec::StreamID> pushedTransactions_;
1427 
1431  std::set<HTTPCodec::StreamID> exTransactions_;
1432 
1437 
1449  uint64_t insertDepth_{0};
1450  uint64_t currentDepth_{0};
1451  double cumulativeRatio_{0};
1452  uint64_t egressCalls_{0};
1453 
1461  uint16_t lastResponseStatus_{0};
1462  uint8_t pendingByteEvents_{0};
1465  folly::Optional<uint64_t> actualResponseLength_{0};
1466 
1467  bool ingressPaused_:1;
1468  bool egressPaused_:1;
1469  bool flowControlPaused_:1;
1470  bool handlerEgressPaused_:1;
1471  bool egressRateLimited_:1;
1472  bool useFlowControl_:1;
1473  bool aborted_:1;
1474  bool deleting_:1;
1475  bool firstByteSent_:1;
1476  bool firstHeaderByteSent_:1;
1477  bool inResume_:1;
1478  bool inActiveSet_:1;
1479  bool ingressErrorSeen_:1;
1480  bool priorityFallback_:1;
1481  bool headRequest_:1;
1482  bool enableLastByteFlushedTracking_:1;
1483 
1485 
1486  uint64_t egressLimitBytesPerMs_{0};
1488  uint64_t numLimitedBytesEgressed_{0};
1489 
1494 
1496 
1498  std::unique_ptr<PrioritySample> prioritySample_;
1499 };
1500 
1504 std::ostream& operator<<(std::ostream& os, const HTTPTransaction& txn);
1505 
1506 } // proxygen
virtual void setHandler(Handler *handler)
virtual void onPushedTransaction(HTTPTransaction *) noexcept
const TransportDirection direction_
HTTPCodec::StreamID id_
static State getNewInstance()
Definition: StateMachine.h:23
folly::Optional< HTTPCodec::StreamID > getAssocTxnId() const
const Transport & getTransport() const
spdy::GoawayStatusCode statusCode
Definition: SPDYCodec.cpp:110
void timeoutExpired() noexceptoverride
void onChunkHeader(size_t) noexceptfinal
typename T::State State
Definition: StateMachine.h:20
LogLevel max
Definition: LogLevel.cpp:31
virtual void onChunkComplete() noexcept
std::ostream & operator<<(std::ostream &os, const HeaderTable &table)
virtual void sendTrailers(const HTTPHeaders &trailers)
std::unique_ptr< HTTPHeaders > trailers_
void setLastByteFlushedTrackingEnabled(bool enabled)
virtual void onGoaway(ErrorCode) noexcept
http2::PriorityUpdate getPriority() const
proxygen::TimePoint startRateLimit_
std::chrono::milliseconds timeToFirstByte
void onHeadersComplete(std::unique_ptr< HTTPMessage >) noexceptfinal
void onPushedTransaction(HTTPTransaction *) noexceptfinal
const wangle::TransportInfo & getSetupTransportInfo() const noexcept
virtual void onChunkHeader(size_t) noexcept
HTTPSessionStats * getSessionStats() const
requires E e noexcept(noexcept(s.error(std::move(e))))
stop_watch< std::chrono::milliseconds > timer_
std::set< HTTPCodec::StreamID > getExTransactions() const
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
Definition: error.h:48
tuple make_tuple()
Definition: gtest-tuple.h:675
folly::Optional< HTTPCodec::ExAttributes > exAttributes_
bool isIngressEOMQueued() const
void getCurrentTransportInfo(wangle::TransportInfo *tinfo) const
const std::set< HTTPCodec::StreamID > & getPushedTransactions() const
folly::Optional< HTTPCodec::StreamID > assocStreamId_
void handler(int, siginfo_t *, void *)
bool isFlowControlPaused() const
void setTransportCallback(TransportCallback *cb)
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
void onTrailers(std::unique_ptr< HTTPHeaders >) noexceptfinal
static bool transit(State &state, Event event)
Definition: StateMachine.h:27
static Options cacheChainLength()
Definition: IOBufQueue.h:83
void getLocalAddress(folly::SocketAddress &addr) const
folly::Optional< uint64_t > expectedContentLengthRemaining_
std::unique_ptr< PrioritySample > prioritySample_
http2::PriorityUpdate priority_
std::list< Chunk > chunkHeaders_
HTTPTransactionEgressSM::State getEgressState() const
virtual HTTPTransaction * newExTransaction(HTTPTransactionHandler *handler, bool unidirectional=false)
static uint64_t egressBufferLimit_
std::unique_ptr< std::queue< HTTPEvent > > deferredIngress_
std::set< HTTPCodec::StreamID > exTransactions_
bool getPriorityFallback() const
void removePushedTransaction(HTTPCodec::StreamID pushStreamId)
std::chrono::milliseconds getIdleTimeout() const
const Handler * getHandler() const
folly::HHWheelTimer * timer_
folly::Optional< uint64_t > expectedResponseLength_
uint32_t getSequenceNumber() const
virtual void onExTransaction(HTTPTransaction *) noexcept
virtual bool needToBlockForReplaySafety() const
virtual bool canSendHeaders() const
typename T::Event Event
Definition: StateMachine.h:21
HTTP2PriorityQueueBase::Handle queueHandle_
virtual HTTPTransaction * newPushedTransaction(HTTPPushTransactionHandler *handler)
virtual bool extraResponseExpected() const
folly::Optional< HTTPCodec::StreamID > getControlStream() const
static bool canTransit(const State state, Event event)
Definition: StateMachine.h:44
const PriorityUpdate DefaultPriority
Definition: HTTP2Framer.cpp:21
virtual void removeWaitingForReplaySafety(folly::AsyncTransport::ReplaySafetyCallback *callback)
SteadyClock::time_point TimePoint
Definition: Time.h:25
std::tuple< uint64_t, uint64_t, double > getPrioritySummary() const
std::set< HTTPCodec::StreamID > pushedTransactions_
const char * string
Definition: Conv.cpp:212
AsyncFizzClient::UniquePtr transport_
const
Definition: upload.py:398
virtual void sendChunkTerminator()
virtual const Window & getReceiveWindow() const
static const folly::Optional< StreamID > NoStream
Definition: HTTPCodec.h:51
uint64_t StreamID
Definition: HTTPCodec.h:49
folly::Optional< std::chrono::milliseconds > transactionTimeout_
folly::Optional< HTTPCodec::ExAttributes > getExAttributes() const
HTTPCodec::StreamID getID() const
const folly::SocketAddress & getPeerAddress() const noexcept
virtual void addWaitingForReplaySafety(folly::AsyncTransport::ReplaySafetyCallback *callback)
std::unique_ptr< Codec > getCodec(CodecType type, int level)
HTTP2PriorityQueueBase & egressQueue_
ThreadPoolListHook * addr
void removeExTransaction(HTTPCodec::StreamID exStreamId)
void onUpgrade(UpgradeProtocol) noexceptfinal
bool supportsPushTransactions() const
void onBody(std::unique_ptr< folly::IOBuf >) noexceptfinal
const folly::SocketAddress & getLocalAddress() const noexcept
void getPeerAddress(folly::SocketAddress &addr) const
std::chrono::milliseconds timeToLastByte
virtual void sendChunkHeader(size_t length)
TransactionInfo(std::chrono::milliseconds ttfb, std::chrono::milliseconds ttlb, uint64_t eHeader, uint64_t inHeader, uint64_t eBody, uint64_t inBody, bool completed)
HTTPTransactionIngressSM::State getIngressState() const
static const folly::Optional< ExAttributes > NoExAttributes
Definition: HTTPCodec.h:66