1 /* This file is part of Pazpar2.
2 Copyright (C) 2006-2013 Index Data
4 Pazpar2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <yaz/wrbuf.h>
24 #include <yaz/timing.h>
29 typedef struct http_channel_observer_s *http_channel_observer_t;
31 typedef struct http_server *http_server_t;
32 typedef struct http_sessions *http_sessions_t;
37 struct http_buf *iqueue;
38 struct http_buf *oqueue;
40 struct http_proxy *proxy;
44 Http_Busy // Don't process new HTTP requests while we're busy
50 struct http_request *request;
51 struct http_response *response;
52 struct http_channel *next; // for freelist
53 char addr[20]; // forwarded address
54 http_channel_observer_t observers;
55 struct conf_server *server;
56 http_server_t http_server;
57 http_sessions_t http_sessions;
60 struct http_proxy // attached to iochan for proxy connection
63 struct http_channel *channel;
64 struct http_buf *oqueue;
72 struct http_header *next;
79 struct http_argument *next;
84 struct http_channel *channel;
85 char http_version[20];
91 struct http_header *headers;
92 struct http_argument *arguments;
99 struct http_channel *channel;
100 struct http_header *headers;
105 void http_mutex_init(struct conf_server *server);
106 void http_server_destroy(http_server_t hs);
108 void http_set_proxyaddr(const char *url, struct conf_server *ser);
109 int http_init(struct conf_server *ser, const char *record_fname);
110 void http_close_server(struct conf_server *ser);
111 void http_addheader(struct http_response *r,
112 const char *name, const char *value);
113 const char *http_lookup_header(struct http_header *header,
115 struct http_header * http_header_append(struct http_channel *ch,
116 struct http_header * hp,
119 const char *http_argbyname(struct http_request *r, const char *name);
120 const char *http_headerbyname(struct http_header *r, const char *name);
121 struct http_response *http_create_response(struct http_channel *c);
122 void http_send_response(struct http_channel *c);
123 void urlencode(const char *i, char *o);
125 typedef void (*http_channel_destroy_t)(void *data, struct http_channel *c,
128 http_channel_observer_t http_add_observer(struct http_channel *c, void *data,
129 http_channel_destroy_t);
130 void http_observer_set_data2(http_channel_observer_t obs, void *data2);
132 void http_remove_observer(http_channel_observer_t obs);
133 struct http_channel *http_channel_observer_chan(http_channel_observer_t obs);
135 void http_command(struct http_channel *c);
137 http_sessions_t http_sessions_create(void);
138 void http_sessions_destroy(http_sessions_t hs);
145 * c-file-style: "Stroustrup"
146 * indent-tabs-mode: nil
148 * vim: shiftwidth=4 tabstop=8 expandtab