StatusLine.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_SRC_HTTP_STATUSLINE_H
10 #define SQUID_SRC_HTTP_STATUSLINE_H
11 
12 #include "http/ProtocolVersion.h"
13 #include "http/StatusCode.h"
14 #include "SquidString.h"
15 
16 class Packable;
17 class String;
18 
19 namespace Http
20 {
21 
28 {
29 public:
31  void init();
32 
34  void clean();
35 
39  void set(const AnyP::ProtocolVersion &newVersion, Http::StatusCode newStatus, const char *newReason = nullptr);
40 
42  void resetReason() { reason_ = nullptr; }
43 
45  Http::StatusCode status() const { return status_; }
46 
48  const char *reason() const;
49 
51  size_t packedLength() const;
52 
54  void packInto(Packable *) const;
55 
60  bool parse(const String &protoPrefix, const char *start, const char *end);
61 
62 public:
63  /* public, read only */
64 
66 
67 private:
70 
72  const char *reason_ = nullptr;
73 };
74 
75 } // namespace Http
76 
77 #endif /* SQUID_SRC_HTTP_STATUSLINE_H */
78 
void resetReason()
reset the reason phrase to its default status code-derived value
Definition: StatusLine.h:42
@ scNone
Definition: StatusCode.h:21
bool parse(const String &protoPrefix, const char *start, const char *end)
Definition: StatusLine.cc:124
size_t packedLength() const
expected size of packInto() output
Definition: StatusLine.cc:50
void packInto(Packable *) const
pack fields into a Packable object
Definition: StatusLine.cc:86
void init()
reset this status-line back to empty state
Definition: StatusLine.cc:22
StatusCode
Definition: StatusCode.h:20
Definition: forward.h:17
Http::StatusCode status() const
retrieve the status code for this status line
Definition: StatusLine.h:45
void set(const AnyP::ProtocolVersion &newVersion, Http::StatusCode newStatus, const char *newReason=nullptr)
Definition: StatusLine.cc:35
const char * reason() const
retrieve the reason string for this status line
Definition: StatusLine.cc:44
AnyP::ProtocolVersion version
breakdown of protocol version label: (HTTP/ICY) and (0.9/1.0/1.1)
Definition: StatusLine.h:65
const char * reason_
points to a constant string (default or supplied), never free()d
Definition: StatusLine.h:72
Http::StatusCode status_
status code. ie 100 ... 200 ... 404 ... 599
Definition: StatusLine.h:69
void clean()
reset this status-line back to Internal Server Error state
Definition: StatusLine.cc:28

 

Introduction

Documentation

Support

Miscellaneous