]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/http/StatusLine.h
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_HTTP_STATUSLINE_H
10 #define SQUID_HTTP_STATUSLINE_H
12 #include "http/ProtocolVersion.h"
13 #include "http/StatusCode.h"
14 #include "SquidString.h"
23 * Holds the values parsed from an HTTP reply status line.
25 * For example: HTTP/1.1 200 OK
30 /// reset this status-line back to empty state
33 /// reset this status-line back to Internal Server Error state
36 /// set this status-line to the given values
37 /// when reason is NULL the default message text for this StatusCode will be used
38 void set(const Http::ProtocolVersion
&newVersion
, Http::StatusCode newStatus
, const char *newReason
= NULL
);
40 /// retrieve the status code for this status line
41 Http::StatusCode
status() const { return status_
; }
43 /// retrieve the reason string for this status line
44 const char *reason() const;
46 /// pack fields using Packer
47 void packInto(Packer
* p
) const;
50 * Parse a buffer and fill internal structures;
51 * \return true on success, false otherwise
53 bool parse(const String
&protoPrefix
, const char *start
, const char *end
);
56 /* public, read only */
59 * By rights protocol name should be a constant "HTTP", with no need for this field to exist.
60 * However there are protocols which violate HTTP by sending their own custom formats
61 * back with other protocol names (ICY streaming format being the current major problem).
63 // XXX: protocol is part of Http::ProtocolVersion. We should be able to use version.protocol instead now.
64 AnyP::ProtocolType protocol
;
66 Http::ProtocolVersion version
; ///< breakdown of protocol version label: (HTTP/ICY) and (0.9/1.0/1.1)
69 /// status code. ie 100 ... 200 ... 404 ... 599
70 Http::StatusCode status_
;
72 /// points to a _constant_ string (default or supplied), never free()d
78 #endif /* SQUID_HTTP_STATUSLINE_H */