File: server.h

package info (click to toggle)
polipo 1.1.1-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,204 kB
  • ctags: 1,694
  • sloc: ansic: 20,882; python: 238; sh: 234; makefile: 139
file content (113 lines) | stat: -rw-r--r-- 4,542 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

extern int serverExpireTime, dontCacheRedirects;

typedef struct _HTTPServer {
    char *name;
    int port;
    int addrindex;
    int isProxy;
    int version;
    int persistent;
    int pipeline;
    int lies;
    int rtt;
    int rate;
    time_t time;
    int numslots;
    int maxslots;
    HTTPConnectionPtr *connection;
    FdEventHandlerPtr *idleHandler;
    HTTPRequestPtr request, request_last;
    struct _HTTPServer *next;
} HTTPServerRec, *HTTPServerPtr;

extern AtomPtr parentHost;
extern int parentPort;

void preinitServer(void);
void initServer(void);

void httpServerAbortHandler(ObjectPtr object);
int httpMakeServerRequest(char *name, int port, ObjectPtr object, 
                          int method, int from, int to,
                          HTTPRequestPtr requestor);
int httpServerQueueRequest(HTTPServerPtr server, HTTPRequestPtr request);
int httpServerTrigger(HTTPServerPtr server);
int httpServerSideRequest(HTTPServerPtr server);
int  httpServerDoSide(HTTPConnectionPtr connection);
int httpServerSideHandler(int status,
                          FdEventHandlerPtr event,
                          StreamRequestPtr srequest);
int httpServerSideHandler2(int status,
                           FdEventHandlerPtr event,
                           StreamRequestPtr srequest);
int httpServerConnectionDnsHandler(int status, 
                                   GethostbynameRequestPtr request);
int httpServerConnectionHandler(int status,
                                FdEventHandlerPtr event,
                                ConnectRequestPtr request);
int httpServerSocksHandler(int status, SocksRequestPtr request);
int httpServerConnectionHandlerCommon(int status,
                                      HTTPConnectionPtr connection);
void httpServerFinish(HTTPConnectionPtr connection, int s, int offset);

void httpServerReply(HTTPConnectionPtr connection, int immediate);
void httpServerAbort(HTTPConnectionPtr connection, int, int, struct _Atom *);
void httpServerAbortRequest(HTTPRequestPtr request, int, int, struct _Atom *);
void httpServerClientReset(HTTPRequestPtr request);
void httpServerUnpipeline(HTTPRequestPtr request);
int
httpServerSendRequest(HTTPConnectionPtr connection);
int
httpServerHandler(int status, 
                    FdEventHandlerPtr event,
                    StreamRequestPtr request);
int
httpServerReplyHandler(int status,
                       FdEventHandlerPtr event, 
                       StreamRequestPtr request);
int
httpServerIndirectHandler(int status,
                          FdEventHandlerPtr event, 
                          StreamRequestPtr request);
int
httpServerDirectHandler(int status,
                        FdEventHandlerPtr event, 
                        StreamRequestPtr request);
int
httpServerDirectHandler2(int status,
                         FdEventHandlerPtr event, 
                         StreamRequestPtr request);
int httpServerRequest(ObjectPtr object, int method, int from, int to,
                      HTTPRequestPtr, void*);
int httpServerHandlerHeaders(int eof,
                             FdEventHandlerPtr event,
                             StreamRequestPtr request, 
                             HTTPConnectionPtr connection);
int httpServerReadData(HTTPConnectionPtr, int);
int connectionAddData(HTTPConnectionPtr connection, int skip);
int 
httpWriteRequest(HTTPConnectionPtr connection, HTTPRequestPtr request, int);

void listServers(FILE*);