f23a578206c898a3d38f1a86ba3c1de29b44e427
[bbaumbach/samba-autobuild/.git] / source4 / web_server / web_server.h
1 /* 
2    Unix SMB/CIFS implementation.
3    
4    Copyright (C) Andrew Tridgell              2005
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #include "smbd/process_model.h"
22
23 /*
24   context of one open web connection
25 */
26 struct websrv_context {
27         struct task_server *task;
28         struct stream_connection *conn;
29         struct {
30                 BOOL tls_detect;
31                 BOOL tls_first_char;
32                 uint8_t first_byte;
33                 DATA_BLOB partial;
34                 BOOL end_of_headers;
35                 char *url;
36                 unsigned content_length;
37                 BOOL post_request;
38                 const char *content_type;
39                 const char *query_string;
40                 const char *user_agent;
41                 const char *referer;
42                 const char *host;
43                 const char *accept_encoding;
44                 const char *accept_language;
45                 const char *accept_charset;
46                 const char *cookie;
47                 const char *session_key;
48         } input;
49         struct {
50                 BOOL output_pending;
51                 DATA_BLOB content;
52                 int fd;
53                 unsigned nsent;
54                 int response_code;
55                 const char **headers;
56         } output;
57         struct tls_context *tls;
58         struct session_data *session;
59 };
60
61
62 /*
63   context for long term storage in the web server, to support session[]
64   and application[] data. Stored in task->private.
65 */
66 struct esp_data {
67         struct session_data {
68                 struct session_data *next, *prev;
69                 struct esp_data *edata;
70                 const char *id;
71                 struct MprVar *data;
72                 struct timed_event *te;
73                 int lifetime;
74         } *sessions;
75         struct MprVar *application_data;
76         struct tls_params *tls_params;
77 };
78