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/serv/request.cc | 279 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 src/serv/request.cc (limited to 'src/serv/request.cc') diff --git a/src/serv/request.cc b/src/serv/request.cc new file mode 100644 index 0000000..163797f --- /dev/null +++ b/src/serv/request.cc @@ -0,0 +1,279 @@ +/************************************************************************* + * + * 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 + */ + +#include + +TOK_IMPL(req_mime_version) { out<req->mime_version; } +TOK_IMPL(req_cont_type) { out<req->cont_type; } +TOK_IMPL(req_cont_type_charset) { out<req->cont_type_charset; } +TOK_IMPL(req_cont_type_name) { out<req->cont_type_name; } +TOK_IMPL(req_cont_type_boundary) { out<req->cont_type_boundary; } +TOK_IMPL(req_cont_id) { out<req->cont_id; } +TOK_IMPL(req_cont_desc) { out<req->cont_desc; } +TOK_IMPL(req_cont_disp) { out<req->cont_disp; } +TOK_IMPL(req_cont_disp_name) { out<req->cont_disp_name; } +TOK_IMPL(req_cont_disp_file) { out<req->cont_disp_file; } +TOK_IMPL(req_cont_trans_enc) { out<req->cont_trans_enc; } +TOK_IMPL(req_cont_length) { out<req->cont_length; } + +TOK_IMPL(req_cache) { out<req->cache; } +TOK_IMPL(req_connect) { out<req->connect; } +TOK_IMPL(req_date) { out<req->date; } +TOK_IMPL(req_pragma) { out<req->pragma; } +TOK_IMPL(req_trailer) { out<req->trailer; } +TOK_IMPL(req_trans_enc) { out<req->trans_enc; } +TOK_IMPL(req_upgrade) { out<req->upgrade; } +TOK_IMPL(req_via) { out<req->via; } +TOK_IMPL(req_warning) { out<req->warning; } +TOK_IMPL(req_allow) { out<req->allow; } +TOK_IMPL(req_cont_enc) { out<req->cont_enc; } +TOK_IMPL(req_cont_lang) { out<req->cont_lang; } +TOK_IMPL(req_cont_location) { out<req->cont_location; } +TOK_IMPL(req_cont_md5) { out<req->cont_md5; } +TOK_IMPL(req_cont_range) { out<req->cont_range; } +TOK_IMPL(req_expires) { out<req->expires; } +TOK_IMPL(req_lastmod) { out<req->lastmod; } + +TOK_IMPL(req_method) { out<req->method; } +TOK_IMPL(req_uri) { out<req->uri; } +TOK_IMPL(req_arg) { out<req->arg; } +TOK_IMPL(req_version) { out<req->version; } +TOK_IMPL(req_accept) { out<req->accept; } +TOK_IMPL(req_accept_charset) { out<req->accept_charset; } +TOK_IMPL(req_accept_enc) { out<req->accept_enc; } +TOK_IMPL(req_accept_lang) { out<req->accept_lang; } +TOK_IMPL(req_accept_range) { out<req->accept_range; } +TOK_IMPL(req_auth) { out<req->auth; } +TOK_IMPL(req_expect) { out<req->expect; } +TOK_IMPL(req_from) { out<req->from; } +TOK_IMPL(req_host) { out<req->host; } +TOK_IMPL(req_if_match) { out<req->if_match; } +TOK_IMPL(req_if_mod) { out<req->if_mod; } +TOK_IMPL(req_if_none) { out<req->if_none; } +TOK_IMPL(req_if_range) { out<req->if_range; } +TOK_IMPL(req_if_unmod) { out<req->if_unmod; } +TOK_IMPL(req_max_forwards) { out<req->max_forwards; } +TOK_IMPL(req_proxy) { out<req->proxy; } +TOK_IMPL(req_range) { out<req->range; } +TOK_IMPL(req_referer) { out<req->referer; } +TOK_IMPL(req_te) { out<req->te; } +TOK_IMPL(req_useragent) { out<req->user_agent; } + +/////////////////////////////////////////////////////////////////// + +TOK_IMPL(resp_cookie) { + Reqd(env)->resp.set_cookies.push_back(cookie_t(env[0],env[1],env.parg(2))); +} +TOK_IMPL(resp_mime_version) { Reqd(env)->resp.mime_version=env[0]; } +TOK_IMPL(resp_cont_type) { Reqd(env)->resp.cont_type=env[0]; } +TOK_IMPL(resp_cont_type_charset) { Reqd(env)->resp.cont_type_charset=env[0]; } +TOK_IMPL(resp_cont_type_name) { Reqd(env)->resp.cont_type_name=env[0]; } +TOK_IMPL(resp_cont_type_boundary) { Reqd(env)->resp.cont_type_boundary=env[0]; } +TOK_IMPL(resp_cont_id) { Reqd(env)->resp.cont_id=env[0]; } +TOK_IMPL(resp_cont_desc) { Reqd(env)->resp.cont_desc=env[0]; } +TOK_IMPL(resp_cont_disp) { Reqd(env)->resp.cont_disp=env[0]; } +TOK_IMPL(resp_cont_disp_name) { Reqd(env)->resp.cont_disp_name=env[0]; } +TOK_IMPL(resp_cont_disp_file) { Reqd(env)->resp.cont_disp_file=env[0]; } +TOK_IMPL(resp_cont_trans_enc) { Reqd(env)->resp.cont_trans_enc=env[0]; } +TOK_IMPL(resp_cont_length) { Reqd(env)->resp.cont_length=env[0]; } + +TOK_IMPL(resp_cache) { Reqd(env)->resp.cache=env[0]; } +TOK_IMPL(resp_connect) { Reqd(env)->resp.connect=env[0]; } +TOK_IMPL(resp_date) { Reqd(env)->resp.date=env[0]; } +TOK_IMPL(resp_pragma) { Reqd(env)->resp.pragma=env[0]; } +TOK_IMPL(resp_trailer) { Reqd(env)->resp.trailer=env[0]; } +TOK_IMPL(resp_trans_enc) { Reqd(env)->resp.trans_enc=env[0]; } +TOK_IMPL(resp_upgrade) { Reqd(env)->resp.upgrade=env[0]; } +TOK_IMPL(resp_via) { Reqd(env)->resp.via=env[0]; } +TOK_IMPL(resp_warning) { Reqd(env)->resp.warning=env[0]; } +TOK_IMPL(resp_allow) { Reqd(env)->resp.allow=env[0]; } +TOK_IMPL(resp_cont_enc) { Reqd(env)->resp.cont_enc=env[0]; } +TOK_IMPL(resp_cont_lang) { Reqd(env)->resp.cont_lang=env[0]; } +TOK_IMPL(resp_cont_location) { Reqd(env)->resp.cont_location=env[0]; } +TOK_IMPL(resp_cont_md5) { Reqd(env)->resp.cont_md5=env[0]; } +TOK_IMPL(resp_cont_range) { Reqd(env)->resp.cont_range=env[0]; } +TOK_IMPL(resp_expires) { Reqd(env)->resp.expires=env[0]; } +TOK_IMPL(resp_lastmod) { Reqd(env)->resp.lastmod=env[0]; } + +TOK_IMPL(resp_version) { Reqd(env)->resp.version=env[0]; } +TOK_IMPL(resp_status) { Reqd(env)->resp.status=env[0]; } +TOK_IMPL(resp_age) { Reqd(env)->resp.age=env[0]; } +TOK_IMPL(resp_etag) { Reqd(env)->resp.etag=env[0]; } +TOK_IMPL(resp_location) { Reqd(env)->resp.location=env[0]; } +TOK_IMPL(resp_proxy_auth) { Reqd(env)->resp.proxy_authent=env[0]; } +TOK_IMPL(resp_retry) { Reqd(env)->resp.retry=env[0]; } +TOK_IMPL(resp_server) { Reqd(env)->resp.server=env[0]; } +TOK_IMPL(resp_vary) { Reqd(env)->resp.vary=env[0]; } +TOK_IMPL(resp_auth) { Reqd(env)->resp.authent=env[0]; } + +TOK_IMPL(resp_accept) { Reqd(env)->resp.accept=env[0]; } +TOK_IMPL(resp_accept_charset) { Reqd(env)->resp.accept_charset=env[0]; } +TOK_IMPL(resp_accept_enc) { Reqd(env)->resp.accept_enc=env[0]; } +TOK_IMPL(resp_accept_lang) { Reqd(env)->resp.accept_lang=env[0]; } +TOK_IMPL(resp_accept_range) { Reqd(env)->resp.accept_range=env[0]; } + +/////////////////////////////////////////////////////////////////// + +TOK_IMPL(resp_getstatus) { out<resp.status; } + +/////////////////////////////////////////////////////////////////// + +TOK_IMPL(andarg) { sref s=Reqd(env)->req->arg; if(s.nempty()) out.put('?')<\n" + "%\n" + "%Sets the cookie name to value val\n" + "%The options field should be on the form expected\n" + "%in the HTTP header, for instance\n" + "%domain=something; path=/; expires=http-data\n" + "%\n" + "%No newlines should be added, and remember that ; needs\n" + "%to be escaped.\n" + ); + + /////////////////////////////////////////////////////////////// + + TOK_ADD(resp_mime_version,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_type,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_type_charset,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_type_name,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_type_boundary,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_id,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_desc,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_disp,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_disp_name,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_disp_file,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_trans_enc,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_length,x_tag,tok_t::SYSONLY,resphelp); + + TOK_ADD(resp_cache,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_connect,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_date,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_pragma,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_trailer,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_trans_enc,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_upgrade,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_via,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_warning,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_allow,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_enc,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_lang,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_location,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_md5,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_cont_range,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_expires,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_lastmod,x_tag,tok_t::SYSONLY,resphelp); + + TOK_ADD(resp_version,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_status,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_age,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_etag,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_location,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_proxy_auth,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_retry,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_server,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_vary,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_auth,x_tag,tok_t::SYSONLY,resphelp); + + TOK_ADD(resp_accept,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_accept_charset,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_accept_enc,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_accept_lang,x_tag,tok_t::SYSONLY,resphelp); + TOK_ADD(resp_accept_range,x_tag,tok_t::SYSONLY,resphelp); + + /////////////////////////////////////////////////////////////// + + TOK_ADD(resp_getstatus,ms_empty,tok_t::PUBLIC,respgethelp); +} -- cgit v1.2.3