aboutsummaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h159
1 files changed, 159 insertions, 0 deletions
diff --git a/src/client.h b/src/client.h
new file mode 100644
index 00000000..32ec65b5
--- /dev/null
+++ b/src/client.h
@@ -0,0 +1,159 @@
1/* Copyrights 2002 Luis Figueiredo (stdio@netc.pt) All rights reserved.
2 *
3 * See the LICENSE file
4 *
5 * The origin of this software must not be misrepresented, either by
6 * explicit claim or by omission. Since few users ever read sources,
7 * credits must appear in the documentation.
8 *
9 * date: Sat Mar 30 14:44:42 GMT 2002
10 *
11 *
12 * --
13 *
14 */
15
16#ifndef _CLIENT_H_
17#define _CLIENT_H_
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <stdio.h>
24#include <fcntl.h>
25#include <string.h>
26#include <errno.h>
27
28
29
30#ifdef HAVE_OPENSSL
31
32#include <openssl/rsa.h> /* SSLeay stuff */
33#include <openssl/crypto.h>
34#include <openssl/x509.h>
35#include <openssl/pem.h>
36#include <openssl/ssl.h>
37#include <openssl/err.h>
38
39#endif
40
41
42#include "socket.h"
43
44#include "memory.h"
45#include "outstream.h"
46
47
48#include "gethandler.h"
49
50
51
52#include "weblog.h"
53#include "utils.h"
54#include "fnmatch.h"
55#include "outgif.h"
56#include "error.h"
57#include "debug.h"
58
59
60#include "clientinfo.h"
61
62
63#ifdef WIN32
64#include "flock.h" // my flock
65#include "dirent.h"
66#else
67#include <sys/file.h> // for flock
68#include <dirent.h>
69#endif
70
71#define READMAX 100000 // 1Mb upload
72#define WRITEMAX 100000 // 1Mb download 1mb per client? // smaller is better for multi read bigger is better for big downloads
73#define MAXURLSIZE 2000 //
74
75extern int WEBTIMEOUT; //to be changed externaly
76//#define WEBTIMEOUT 10000 // TIMEOUT WITHOUT RECEIVING DATA (not in seconds but in read tries)
77
78
79struct web_var {
80 char *name;
81 char *value;
82 struct web_var *next;
83};
84
85struct web_client {
86
87 int socket;
88 struct sockaddr_in sa;
89 unsigned int salen;
90 char *HTTPdirective;
91 unsigned char stat; /* 0001b idle,0010b down streaming, 0011 done down streaming, 0100b out streaming,0101 done out streaming */
92 // Read control
93 char *rbuf;
94 unsigned long rbufsize;
95 int newdata_try;
96 unsigned long contentlength; // for read propose (optimize speed 0.5.1)
97 unsigned long headersize;
98
99 // Write control
100 struct outstream *outstream;
101 struct web_var *varlist;
102 char *cookies; // cookie header (0.5.1)
103 long writelength;
104 long readsize;
105 long range;
106 int skipped;
107 long wheadersize;
108// clock_t oldcl,curcl;
109
110#ifdef HAVE_OPENSSL
111 SSL *ssl;
112 X509* cert;
113#else
114 void *pad[2];
115#endif
116 struct web_client *next;
117};
118extern struct web_client *current_web_client;
119
120struct web_client *__ILWS_init_client_list();
121int __ILWS_add_client(struct web_client *,struct web_client *);
122void __ILWS_delete_next_client(struct web_client *);
123void __ILWS_delete_client_list(struct web_client *);
124
125void __ILWS_read_client(struct web_client *);
126void __ILWS_process_client(struct web_client *,struct gethandler *);
127void __ILWS_output_client(struct web_client *);
128
129void __ILWS_web_client_writef(struct web_client *,const char *,...);
130
131int web_client_addfile(char *);
132void web_client_contenttype(char *); // new on 0.5.2
133
134void web_client_gifsetpalette(const char *);
135
136extern unsigned char __ILWS_GLOBALGIFPAL[256][3];
137
138int web_client_gifoutput(char *,int,int,int);
139
140void web_client_HTTPdirective(char *);
141
142char *__ILWS_web_client_getreqline();
143char *__ILWS_web_client_getreq();
144// new (0.5.1)
145int web_client_setvar(char *,char *);
146char *web_client_getvar(char *);
147int web_client_delvar(char *);
148
149// put in var.h
150struct web_var *__ILWS_init_var_list();
151int __ILWS_add_var(struct web_var *, char *, char *);
152int __ILWS_del_var(struct web_var *, char *);
153void __ILWS_delete_var_list(struct web_var *);
154char *__ILWS_get_var(struct web_var *list , char *name);
155
156int __ILWS_lws_list(char *); // new on 0.5.2
157
158#endif
159