]> git.ipfire.org Git - thirdparty/squid.git/blame - src/HttpStatusLine.h
Author: Bernard <fli4l.charrier@free.fr>
[thirdparty/squid.git] / src / HttpStatusLine.h
CommitLineData
450e0c10 1/*
262a0e14 2 * $Id$
450e0c10 3 *
4 *
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
7 *
8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
26ac0430 21 *
450e0c10 22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26ac0430 26 *
450e0c10 27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
30 *
31 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
32 */
450e0c10 33#ifndef SQUID_HTTPSTATUSLINE_H
34#define SQUID_HTTPSTATUSLINE_H
35
e1f7507e
AJ
36class Packer;
37class String;
38
e77d7ef0 39/* for http_status and protocol_t */
e1f7507e
AJ
40#include "enums.h"
41
450e0c10 42#include "HttpVersion.h"
e77d7ef0 43#include "SquidString.h"
450e0c10 44
e77d7ef0
AJ
45/**
46 * Holds the values parsed from an HTTP reply status line.
47 *
48 * For example: HTTP/1.1 200 Okay
49 */
450e0c10 50class HttpStatusLine
51{
450e0c10 52public:
53 /* public, read only */
e77d7ef0
AJ
54
55 /**
56 * By rights protocol name should be a constant "HTTP", with no need for this field to exist.
57 * However there are protocols which violate HTTP by sending their wn custom formats
58 * back with other protocol names (ICY streaming format being the current major problem)
59 */
60 protocol_t protocol;
61
62 HttpVersion version; ///< breakdown of protocol version labels: 0.9 1.0 1.1
63 http_status status; ///< status code. ie 200 404
64 const char *reason; ///< points to a _constant_ string (default or supplied), never free()d */
450e0c10 65};
66
67/* init/clean */
68SQUIDCEXTERN void httpStatusLineInit(HttpStatusLine * sline);
69SQUIDCEXTERN void httpStatusLineClean(HttpStatusLine * sline);
70/* set/get values */
71SQUIDCEXTERN void httpStatusLineSet(HttpStatusLine * sline, HttpVersion version,
72 http_status status, const char *reason);
73SQUIDCEXTERN const char *httpStatusLineReason(const HttpStatusLine * sline);
74/* parse/pack */
75/* parse a 0-terminating buffer and fill internal structires; returns true on success */
30abd221 76SQUIDCEXTERN int httpStatusLineParse(HttpStatusLine * sline, const String &protoPrefix,
8596962e 77 const char *start, const char *end);
450e0c10 78/* pack fields using Packer */
79SQUIDCEXTERN void httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p);
80
81#endif /* SQUID_HTTPSTATUSLINE_H */