StatusLine.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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_HTTP_STATUSLINE_H
10 #define SQUID_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 = NULL);
40 
42  void resetReason() { reason_ = nullptr; }
43 
45  Http::StatusCode status() const { return status_; }
46 
48  const char *reason() const;
49 
51  void packInto(Packable *) const;
52 
57  bool parse(const String &protoPrefix, const char *start, const char *end);
58 
59 public:
60  /* public, read only */
61 
67  // XXX: protocol is part of AnyP::ProtocolVersion. We should be able to use version.protocol instead now.
69 
71 
72 private:
75 
77  const char *reason_;
78 };
79 
80 } // namespace Http
81 
82 #endif /* SQUID_HTTP_STATUSLINE_H */
83 
void clean()
reset this status-line back to Internal Server Error state
Definition: StatusLine.cc:23
void packInto(Packable *) const
pack fields into a Packable object
Definition: StatusLine.cc:46
void set(const AnyP::ProtocolVersion &newVersion, Http::StatusCode newStatus, const char *newReason=NULL)
Definition: StatusLine.cc:30
Http::StatusCode status_
status code. ie 100 ... 200 ... 404 ... 599
Definition: StatusLine.h:74
const char * reason() const
retrieve the reason string for this status line
Definition: StatusLine.cc:40
void init()
reset this status-line back to empty state
Definition: StatusLine.cc:17
StatusCode
Definition: StatusCode.h:20
bool parse(const String &protoPrefix, const char *start, const char *end)
Definition: StatusLine.cc:75
AnyP::ProtocolType protocol
Definition: StatusLine.h:68
const char * reason_
points to a constant string (default or supplied), never free()d
Definition: StatusLine.h:77
void resetReason()
reset the reason phrase to its default status code-derived value
Definition: StatusLine.h:42
ProtocolType
Definition: ProtocolType.h:22
AnyP::ProtocolVersion version
breakdown of protocol version label: (HTTP/ICY) and (0.9/1.0/1.1)
Definition: StatusLine.h:70
#define NULL
Definition: types.h:166
Http::StatusCode status() const
retrieve the status code for this status line
Definition: StatusLine.h:45

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors