1 /* Shared object scripts.
2 * - by Richard W.M. Jones <rich@annexia.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 * $Id: rws_request.c,v 1.5 2002/12/01 14:58:02 rich Exp $
24 #include "rws_request.h"
28 http_request http_request;
30 const char *host_header;
31 const char *canonical_path;
32 const char *file_path;
34 /* These are used for retrieving configuration information.
35 * XXX These are also a huge hack which will be removed when we
36 * have a decent configuration object type in c2lib.
40 const char * (*cfg_get_string) (void *, void *, const char *, const char *);
41 int (*cfg_get_int) (void *, void *, const char *, int);
42 int (*cfg_get_bool) (void *, void *, const char *, int);
46 new_rws_request (pool pool, http_request http_request, io_handle io,
47 const char *host_header, const char *canonical_path,
48 const char *file_path, void *host, void *alias,
49 const char * (*cfg_get_string)
50 (void *, void *, const char *, const char *),
51 int (*cfg_get_int) (void *, void *, const char *, int),
52 int (*cfg_get_bool) (void *, void *, const char *, int))
54 rws_request p = pmalloc (pool, sizeof *p);
56 p->http_request = http_request;
58 p->host_header = host_header;
59 p->canonical_path = canonical_path;
60 p->file_path = file_path;
63 p->cfg_get_string = cfg_get_string;
64 p->cfg_get_int = cfg_get_int;
65 p->cfg_get_bool = cfg_get_bool;
71 rws_request_http_request (rws_request p)
73 return p->http_request;
77 rws_request_io (rws_request p)
83 rws_request_host_header (rws_request p)
85 return p->host_header;
89 rws_request_canonical_path (rws_request p)
91 return p->canonical_path;
95 rws_request_file_path (rws_request p)
101 rws_request_cfg_get_string (rws_request p,
102 const char *key, const char *default_value)
104 return p->cfg_get_string (p->host, p->alias, key, default_value);
108 rws_request_cfg_get_int (rws_request p,
109 const char *key, int default_value)
111 return p->cfg_get_int (p->host, p->alias, key, default_value);
115 rws_request_cfg_get_bool (rws_request p,
116 const char *key, int default_value)
118 return p->cfg_get_bool (p->host, p->alias, key, default_value);