Coverage Report

Created: 2026-10-31 07:06

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/trafficserver/include/proxy/http/Http1Transaction.h
Line
Count
Source
1
/** @file
2
3
  Http1Transaction.h - The Transaction class for Http1*
4
5
  @section license 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
#pragma once
25
26
#include <string_view>
27
28
using namespace std::literals;
29
30
#include "proxy/ProxyTransaction.h"
31
32
class Continuation;
33
34
class Http1Transaction : public ProxyTransaction
35
{
36
public:
37
  using super_type = ProxyTransaction;
38
39
0
  Http1Transaction(ProxySession *session) : super_type(session) {}
40
  ~Http1Transaction() = default;
41
42
0
  Http1Transaction() {}
43
44
  void reset();
45
46
  ////////////////////
47
  // Methods
48
  int  get_transaction_id() const override;
49
  void set_reader(IOBufferReader *reader);
50
  void set_close_connection(HTTPHdr &hdr) const override;
51
52
  ////////////////////
53
  // Variables
54
55
protected:
56
};
57
58
inline int
59
Http1Transaction::get_transaction_id() const
60
0
{
61
  // For HTTP/1 there is only one on-going transaction at a time per session/connection.  Therefore, the transaction count can be
62
  // presumed not to increase during the lifetime of a transaction, thus this function will return a consistent unique transaction
63
  // identifier.
64
  //
65
0
  return _proxy_ssn->get_transact_count();
66
0
}
67
68
inline void
69
Http1Transaction::reset()
70
0
{
71
0
  _sm = nullptr;
72
0
}
73
74
inline void
75
Http1Transaction::set_reader(IOBufferReader *reader)
76
0
{
77
0
  _reader = reader;
78
0
}
79
80
inline void
81
Http1Transaction::set_close_connection(HTTPHdr &hdr) const
82
0
{
83
0
  hdr.value_set(static_cast<std::string_view>(MIME_FIELD_CONNECTION), "close"sv);
84
0
}