aboutsummaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h126
1 files changed, 53 insertions, 73 deletions
diff --git a/src/client.h b/src/client.h
index 32ec65b5..6217b271 100644
--- a/src/client.h
+++ b/src/client.h
@@ -25,41 +25,12 @@
25#include <string.h> 25#include <string.h>
26#include <errno.h> 26#include <errno.h>
27 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" 28#include "socket.h"
43
44#include "memory.h" 29#include "memory.h"
45#include "outstream.h"
46
47
48#include "gethandler.h"
49
50
51
52#include "weblog.h"
53#include "utils.h" 30#include "utils.h"
54#include "fnmatch.h" 31#include "fnmatch.h"
55#include "outgif.h"
56#include "error.h"
57#include "debug.h"
58
59
60#include "clientinfo.h" 32#include "clientinfo.h"
61 33
62
63#ifdef WIN32 34#ifdef WIN32
64#include "flock.h" // my flock 35#include "flock.h" // my flock
65#include "dirent.h" 36#include "dirent.h"
@@ -68,89 +39,98 @@
68#include <dirent.h> 39#include <dirent.h>
69#endif 40#endif
70 41
42struct gethandler {
43 char * str;
44 void (*func)();
45 void * ctx;
46 struct gethandler * next;
47};
48
49
50
71#define READMAX 100000 // 1Mb upload 51#define READMAX 100000 // 1Mb upload
52
72#define WRITEMAX 100000 // 1Mb download 1mb per client? // smaller is better for multi read bigger is better for big downloads 53#define WRITEMAX 100000 // 1Mb download 1mb per client? // smaller is better for multi read bigger is better for big downloads
54
73#define MAXURLSIZE 2000 // 55#define MAXURLSIZE 2000 //
74 56
75extern int WEBTIMEOUT; //to be changed externaly 57extern int WEBTIMEOUT; //to be changed externaly
76//#define WEBTIMEOUT 10000 // TIMEOUT WITHOUT RECEIVING DATA (not in seconds but in read tries) 58//#define WEBTIMEOUT 10000 // TIMEOUT WITHOUT RECEIVING DATA (not in seconds but in read tries)
77 59
78
79struct web_var { 60struct web_var {
80 char *name; 61 char *name;
81 char *value; 62 char *value;
82 struct web_var *next; 63 struct web_var *next;
83}; 64};
84 65
85struct web_client { 66struct web_client {
86 67 int socket;
87 int socket; 68 struct sockaddr_in sa;
88 struct sockaddr_in sa; 69 unsigned int salen;
89 unsigned int salen; 70 char *HTTPdirective;
90 char *HTTPdirective; 71 unsigned char stat; /* 0001b idle,0010b down streaming, 0011 done down streaming, 0100b out streaming,0101 done out streaming */
91 unsigned char stat; /* 0001b idle,0010b down streaming, 0011 done down streaming, 0100b out streaming,0101 done out streaming */ 72 // Read control
92 // Read control 73 char *rbuf;
93 char *rbuf; 74 unsigned long rbufsize;
94 unsigned long rbufsize; 75 int newdata_try;
95 int newdata_try; 76 unsigned long contentlength; // for read propose (optimize speed 0.5.1)
96 unsigned long contentlength; // for read propose (optimize speed 0.5.1) 77 unsigned long headersize;
97 unsigned long headersize; 78
98 79 // Write control
99 // Write control 80 struct outstream *outstream;
100 struct outstream *outstream; 81 struct web_var *varlist;
101 struct web_var *varlist; 82 char *cookies; // cookie header (0.5.1)
102 char *cookies; // cookie header (0.5.1) 83 long writelength;
103 long writelength; 84 long readsize;
104 long readsize; 85 long range;
105 long range; 86 int skipped;
106 int skipped; 87 long wheadersize;
107 long wheadersize; 88 struct web_client * next;
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}; 89};
118extern struct web_client *current_web_client;
119 90
120struct web_client *__ILWS_init_client_list(); 91struct web_client *__ILWS_init_client_list(void);
121int __ILWS_add_client(struct web_client *,struct web_client *); 92
93int __ILWS_add_client(struct web_client *,
94 struct web_client *);
95
122void __ILWS_delete_next_client(struct web_client *); 96void __ILWS_delete_next_client(struct web_client *);
97
123void __ILWS_delete_client_list(struct web_client *); 98void __ILWS_delete_client_list(struct web_client *);
124 99
125void __ILWS_read_client(struct web_client *); 100void __ILWS_read_client(struct web_client *);
101
126void __ILWS_process_client(struct web_client *,struct gethandler *); 102void __ILWS_process_client(struct web_client *,struct gethandler *);
103
127void __ILWS_output_client(struct web_client *); 104void __ILWS_output_client(struct web_client *);
128 105
129void __ILWS_web_client_writef(struct web_client *,const char *,...); 106void __ILWS_web_client_writef(struct web_client *,const char *,...);
130 107
131int web_client_addfile(char *); 108int web_client_addfile(char *);
132void web_client_contenttype(char *); // new on 0.5.2
133
134void web_client_gifsetpalette(const char *);
135 109
136extern unsigned char __ILWS_GLOBALGIFPAL[256][3]; 110void web_client_contenttype(char *); // new on 0.5.2
137
138int web_client_gifoutput(char *,int,int,int);
139 111
140void web_client_HTTPdirective(char *); 112void web_client_HTTPdirective(char *);
141 113
142char *__ILWS_web_client_getreqline(); 114char *__ILWS_web_client_getreqline();
115
143char *__ILWS_web_client_getreq(); 116char *__ILWS_web_client_getreq();
117
144// new (0.5.1) 118// new (0.5.1)
145int web_client_setvar(char *,char *); 119int web_client_setvar(char *,char *);
120
146char *web_client_getvar(char *); 121char *web_client_getvar(char *);
122
147int web_client_delvar(char *); 123int web_client_delvar(char *);
148 124
149// put in var.h 125// put in var.h
150struct web_var *__ILWS_init_var_list(); 126struct web_var *__ILWS_init_var_list();
127
151int __ILWS_add_var(struct web_var *, char *, char *); 128int __ILWS_add_var(struct web_var *, char *, char *);
129
152int __ILWS_del_var(struct web_var *, char *); 130int __ILWS_del_var(struct web_var *, char *);
131
153void __ILWS_delete_var_list(struct web_var *); 132void __ILWS_delete_var_list(struct web_var *);
133
154char *__ILWS_get_var(struct web_var *list , char *name); 134char *__ILWS_get_var(struct web_var *list , char *name);
155 135
156int __ILWS_lws_list(char *); // new on 0.5.2 136int __ILWS_lws_list(char *); // new on 0.5.2