From 5df79c53745fde5d6c3340a2979b1429cd5892c1 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 8 Oct 2011 20:30:28 +0200 Subject: Initial import of htcd system 1.0 Signed-off-by: Henrik Rydberg --- src/http/mime.h | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 src/http/mime.h (limited to 'src/http/mime.h') diff --git a/src/http/mime.h b/src/http/mime.h new file mode 100644 index 0000000..85200cc --- /dev/null +++ b/src/http/mime.h @@ -0,0 +1,99 @@ +/************************************************************************* + * + * HTCd - Copyright (C) 1998-2006 Henrik Rydberg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MIMEHTTPH +#define MIMEHTTPH + +#include +#include + +// Entity Headers +const mstring allow_tag="Allow"; +const mstring accept_tag="Accept"; +const mstring accept_charset_tag="Accept-Charset"; +const mstring accept_enc_tag="Accept-Encoding"; +const mstring accept_lang_tag="Accept-Language"; +const mstring accept_range_tag="Accept-Ranges"; +const mstring cont_enc_tag="Content-Encoding"; +const mstring cont_lang_tag="Content-Language"; +const mstring cont_location_tag="Content-Location"; +const mstring cont_md5_tag="Content-MD5"; +const mstring cont_range_tag="Content-Range"; +const mstring expires_tag="Expires"; +const mstring lastmod_tag="Last-Modified"; +// General headers +const mstring cache_tag="Cache-Control"; +const mstring connect_tag="Connection"; +const mstring date_tag="Date"; +const mstring pragma_tag="Pragma"; +const mstring trailer_tag="Trailer"; +const mstring trans_enc_tag="Transfer-Encoding"; +const mstring upgrade_tag="Upgrade"; +const mstring via_tag="Via"; +const mstring warning_tag="Warning"; +// Request headers +const mstring auth_tag="Authorization"; +const mstring expect_tag="Expect"; +const mstring host_tag="Host"; +const mstring if_match_tag="If-Match"; +const mstring if_mod_tag="If-Modified-Since"; +const mstring if_none_tag="If-None-Match"; +const mstring if_range_tag="If-Range"; +const mstring if_unmod_tag="If-Unmodified-Since"; +const mstring max_forwards_tag="Max-Forwards"; +const mstring proxy_tag="Proxy-Authorization"; +const mstring range_tag="Range"; +const mstring referer_tag="Referer"; +const mstring te_tag="TE"; +const mstring user_agent_tag="User-Agent"; +const mstring cookie_tag="Cookie"; +// Response headers +const mstring age_tag="Age"; +const mstring etag_tag="ETag"; +const mstring location_tag="Location"; +const mstring proxy_authent_tag="Proxy-Authenticate"; +const mstring retry_tag="Retry-After"; +const mstring server_tag="Server"; +const mstring vary_tag="Vary"; +const mstring authent_tag="WWW-Authenticate"; +const mstring set_cookie_tag="Set-Cookie"; + +class HTTP : public Mime { +public: + HTTP(); + HTTP(const sref& msg) { Init(msg); } + + mstring cache,connect,date,pragma; + mstring trailer,trans_enc,upgrade,via,warning; + mstring allow,cont_enc,cont_lang,cont_location; + mstring cont_md5,cont_range,expires,lastmod; + mstring accept,accept_charset,accept_enc,accept_lang,accept_range; + + time_t idate; + void putHead(mstream& out) const; +protected: + int Special(sref line); + int Handle(const sref& name, + const sref& rawval, + const sref& val, + const rrpile& opts); +}; + +#endif + -- cgit v1.2.3