Coverage Report

Created: 2024-09-19 09:45

/proc/self/cwd/envoy/http/stream_reset_handler.h
Line
Count
Source
1
#pragma once
2
3
#include "envoy/common/pure.h"
4
5
// Stream Reset is refactored from the codec to avoid cyclical dependencies with
6
// the BufferMemoryAccount interface.
7
namespace Envoy {
8
namespace Http {
9
10
/**
11
 * Stream reset reasons.
12
 */
13
enum class StreamResetReason {
14
  // If a local codec level reset was sent on the stream.
15
  LocalReset,
16
  // If a local codec level refused stream reset was sent on the stream (allowing for retry).
17
  LocalRefusedStreamReset,
18
  // If a remote codec level reset was received on the stream.
19
  RemoteReset,
20
  // If a remote codec level refused stream reset was received on the stream (allowing for retry).
21
  RemoteRefusedStreamReset,
22
  // If the stream was locally reset by a connection pool due to an initial local connection
23
  // failure.
24
  LocalConnectionFailure,
25
  // If the stream was locally reset by a connection pool due to an initial remote connection
26
  // failure.
27
  RemoteConnectionFailure,
28
  // If the stream was reset due to timing out while creating a new connection.
29
  ConnectionTimeout,
30
  // If the stream was locally reset due to connection termination.
31
  ConnectionTermination,
32
  // The stream was reset because of a resource overflow.
33
  Overflow,
34
  // Either there was an early TCP error for a CONNECT request or the peer reset with CONNECT_ERROR
35
  ConnectError,
36
  // Received payload did not conform to HTTP protocol.
37
  ProtocolError,
38
  // If the stream was locally reset by the Overload Manager.
39
  OverloadManager,
40
  // If stream was locally reset due to HTTP/1 upstream half closing before downstream.
41
  Http1PrematureUpstreamHalfClose,
42
};
43
44
/**
45
 * Handler to reset an underlying HTTP stream.
46
 */
47
class StreamResetHandler {
48
public:
49
394k
  virtual ~StreamResetHandler() = default;
50
  /**
51
   * Reset the stream. No events will fire beyond this point.
52
   * @param reason supplies the reset reason.
53
   */
54
  virtual void resetStream(StreamResetReason reason) PURE;
55
};
56
57
} // namespace Http
58
} // namespace Envoy