Coverage Report

Created: 2026-07-16 07:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/haproxy/include/haproxy/h1_htx.h
Line
Count
Source
1
/*
2
 * include/haproxy/h1_htx.h
3
 * This file defines function prototypes for H1 manipulation using the
4
 * internal representation.
5
 *
6
 * Copyright (C) 2019 HAProxy Technologies, Christopher Faulet <cfaulet@haproxy.com>
7
 *
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Lesser General Public
10
 * License as published by the Free Software Foundation, version 2.1
11
 * exclusively.
12
 *
13
 * This library is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 * Lesser General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public
19
 * License along with this library; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
 */
22
23
#ifndef _HAPROXY_H1_HTX_H
24
#define _HAPROXY_H1_HTX_H
25
26
#include <import/ist.h>
27
#include <haproxy/api-t.h>
28
#include <haproxy/buf-t.h>
29
#include <haproxy/h1.h>
30
#include <haproxy/htx.h>
31
32
int h1_parse_msg_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx *dsthtx,
33
          struct buffer *srcbuf, size_t ofs, size_t max);
34
size_t h1_parse_msg_data(struct h1m *h1m, struct htx **dsthtx,
35
       struct buffer *srcbuf, size_t ofs, size_t max,
36
       struct buffer *htxbuf);
37
int h1_parse_msg_tlrs(struct h1m *h1m, struct htx *dsthtx,
38
          struct buffer *srcbuf, size_t ofs, size_t max);
39
40
/* Returns the URI of an HTX message in the most common format for a H1 peer. It
41
 * is the path part of an absolute URI when the URI was normalized, otherwise
42
 * it is the whole URI, as received. Concretely, it is only a special case for
43
 * URIs received from H2 clients, to be able to send a relative path the H1
44
 * servers.
45
 */
46
static inline struct ist h1_get_uri(const struct htx_sl *sl)
47
0
{
48
0
  struct ist uri;
49
50
0
  uri = htx_sl_req_uri(sl);
51
0
  if (sl->flags & HTX_SL_F_NORMALIZED_URI) {
52
0
    struct http_uri_parser parser = http_uri_parser_init(uri);
53
0
    uri = http_parse_path(&parser);
54
0
    if (unlikely(!uri.len)) {
55
0
      if (sl->info.req.meth == HTTP_METH_OPTIONS)
56
0
        uri = ist("*");
57
0
      else
58
0
        uri = ist("/");
59
0
    }
60
0
  }
61
0
  return uri;
62
0
}
Unexecuted instantiation: fuzz_h1_htx.c:h1_get_uri
Unexecuted instantiation: h1_htx.c:h1_get_uri
Unexecuted instantiation: http_fetch.c:h1_get_uri
63
64
int h1_format_htx_reqline(const struct htx_sl *sl, struct buffer *chk);
65
int h1_format_htx_stline(const struct htx_sl *sl, struct buffer *chk);
66
int h1_format_htx_hdr(const struct ist n, const struct ist v, struct buffer *chk);
67
int h1_format_htx_data(const struct ist data, struct buffer *chk, int chunked);
68
int h1_format_htx_msg(const struct htx *htx, struct buffer *outbuf);
69
70
#endif /* _HAPROXY_H1_HTX_H */
71
72
/*
73
 * Local variables:
74
 *  c-indent-level: 8
75
 *  c-basic-offset: 8
76
 * End:
77
 */