Coverage Report

Created: 2026-11-11 06:15

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/trafficserver/include/proxy/http/Http1ServerSession.h
Line
Count
Source
1
/** @file
2
3
  A brief file description
4
5
  @par License
6
7
  Licensed to the Apache Software Foundation (ASF) under one
8
  or more contributor license agreements.  See the NOTICE file
9
  distributed with this work for additional information
10
  regarding copyright ownership.  The ASF licenses this file
11
  to you under the Apache License, Version 2.0 (the
12
  "License"); you may not use this file except in compliance
13
  with the License.  You may obtain a copy of the License at
14
15
      http://www.apache.org/licenses/LICENSE-2.0
16
17
  Unless required by applicable law or agreed to in writing, software
18
  distributed under the License is distributed on an "AS IS" BASIS,
19
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
  See the License for the specific language governing permissions and
21
  limitations under the License.
22
 */
23
24
/****************************************************************************
25
26
   Http1ServerSession.h
27
28
   Description:
29
30
31
 ****************************************************************************/
32
33
#pragma once
34
35
#include "iocore/net/ConnectionTracker.h"
36
#include "iocore/net/SessionSharingAPIEnums.h"
37
#include "proxy/PoolableSession.h"
38
#include "proxy/http/Http1ServerTransaction.h"
39
40
class HttpSM;
41
class MIOBuffer;
42
class IOBufferReader;
43
44
enum class Http1ServerSessionMagic : uint32_t {
45
  ALIVE = 0x0123FEED,
46
  DEAD  = 0xDEADFEED,
47
};
48
49
class Http1ServerSession : public PoolableSession
50
{
51
  using self_type  = Http1ServerSession;
52
  using super_type = PoolableSession;
53
54
public:
55
  Http1ServerSession();
56
  Http1ServerSession(self_type const &)   = delete;
57
  self_type &operator=(self_type const &) = delete;
58
0
  ~Http1ServerSession()                   = default;
59
60
  ////////////////////
61
  // Methods
62
  void release(ProxyTransaction *) override;
63
  void destroy() override;
64
  void release_transaction();
65
66
  // VConnection Methods
67
  void do_io_close(int lerrno = -1) override;
68
69
  // ProxySession Methods
70
  int         get_transact_count() const override;
71
  const char *get_protocol_string() const override;
72
  void        increment_current_active_connections_stat() override;
73
  void        decrement_current_active_connections_stat() override;
74
  void        new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader) override;
75
  void        start() override;
76
  void        free() override;
77
  bool        is_chunked_encoding_supported() const override;
78
79
  IOBufferReader   *get_remote_reader() override;
80
  IpEndpoint const &get_server_ip() const;
81
82
  ProxyTransaction *new_transaction() override;
83
84
  ////////////////////
85
  // Variables
86
87
  int transact_count = 0;
88
89
  // The ServerSession owns the following buffer which use
90
  //   for parsing the headers.  The server session needs to
91
  //   own the buffer so we can go from a keep-alive state
92
  //   to being acquired and parsing the header without
93
  //   changing the buffer we are doing I/O on.  We can
94
  //   not change the buffer for I/O without issuing a
95
  //   an asynchronous cancel on NT
96
  MIOBuffer *read_buffer = nullptr;
97
98
private:
99
  void pool_or_close();
100
101
  Http1ServerSessionMagic magic = Http1ServerSessionMagic::DEAD;
102
103
  IOBufferReader *_reader = nullptr;
104
105
  int released_transactions = 0;
106
107
  Http1ServerTransaction trans;
108
};
109
110
extern ClassAllocator<Http1ServerSession> httpServerSessionAllocator;
111
112
////////////////////////////////////////////
113
// INLINE
114
115
inline IOBufferReader *
116
Http1ServerSession::get_remote_reader()
117
0
{
118
0
  return _reader;
119
0
};