root / trunk / src / dot / proxy / server.h

Revision 7619, 4.5 kB (checked in by BradNeuberg, 22 months ago)

Completely changed how we deal with the network not being present if we launch a network request -- doing it at a much deeper level now, which means that for any kind of network error, either a DNS error, a dropped server communication, etc. we now drop down, switch to offline mode, and attempt to replay the request -- tested on Safari and Firefox on Mac OS X, works on IE with one bug that I am ironing out now

Line 
1/*
2Copyright (c) 2003-2006 by Juliusz Chroboczek
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20THE SOFTWARE.
21*/
22
23extern int serverExpireTime, dontCacheRedirects;
24
25typedef struct _HTTPServer {
26    char *name;
27    int port;
28    int addrindex;
29    int isProxy;
30    int version;
31    int persistent;
32    int pipeline;
33    int lies;
34    int rtt;
35    int rate;
36    time_t time;
37    int numslots;
38    int maxslots;
39    HTTPConnectionPtr *connection;
40    FdEventHandlerPtr *idleHandler;
41    HTTPRequestPtr request, request_last;
42    struct _HTTPServer *next;
43} HTTPServerRec, *HTTPServerPtr;
44
45extern AtomPtr parentHost;
46extern int parentPort;
47
48void preinitServer(void);
49void initServer(void);
50
51void httpServerAbortHandler(ObjectPtr object);
52int httpMakeServerRequest(char *name, int port, ObjectPtr object,
53                          int method, int from, int to,
54                          HTTPRequestPtr requestor);
55int httpServerQueueRequest(HTTPServerPtr server, HTTPRequestPtr request);
56int httpServerTrigger(HTTPServerPtr server);
57int httpServerSideRequest(HTTPServerPtr server);
58int  httpServerDoSide(HTTPConnectionPtr connection);
59int httpServerSideHandler(int status,
60                          FdEventHandlerPtr event,
61                          StreamRequestPtr srequest);
62int httpServerSideHandler2(int status,
63                           FdEventHandlerPtr event,
64                           StreamRequestPtr srequest);
65int httpServerConnectionDnsHandler(int status,
66                                   GethostbynameRequestPtr request);
67int httpServerConnectionHandler(int status,
68                                FdEventHandlerPtr event,
69                                ConnectRequestPtr request);
70int httpServerSocksHandler(int status, SocksRequestPtr request);
71int httpServerConnectionHandlerCommon(int status,
72                                      HTTPConnectionPtr connection);
73void httpServerFinish(HTTPConnectionPtr connection, int s, int offset);
74
75void httpServerReply(HTTPConnectionPtr connection, int immediate);
76void httpServerAbort(HTTPConnectionPtr connection, int, int, struct _Atom *);
77void httpServerAbortRequest(HTTPRequestPtr request, int, int, struct _Atom *);
78void httpServerClientReset(HTTPRequestPtr request);
79void httpServerUnpipeline(HTTPRequestPtr request);
80int
81httpServerSendRequest(HTTPConnectionPtr connection);
82int
83httpServerHandler(int status,
84                    FdEventHandlerPtr event,
85                    StreamRequestPtr request);
86int
87httpServerReplyHandler(int status,
88                       FdEventHandlerPtr event,
89                       StreamRequestPtr request);
90int
91httpServerIndirectHandler(int status,
92                          FdEventHandlerPtr event,
93                          StreamRequestPtr request);
94int
95httpServerDirectHandler(int status,
96                        FdEventHandlerPtr event,
97                        StreamRequestPtr request);
98int
99httpServerDirectHandler2(int status,
100                         FdEventHandlerPtr event,
101                         StreamRequestPtr request);
102int httpServerRequest(ObjectPtr object, int method, int from, int to,
103                      HTTPRequestPtr, void*);
104int httpServerHandlerHeaders(int eof,
105                             FdEventHandlerPtr event,
106                             StreamRequestPtr request,
107                             HTTPConnectionPtr connection);
108int httpServerReadData(HTTPConnectionPtr, int);
109int connectionAddData(HTTPConnectionPtr connection, int skip);
110int 
111httpWriteRequest(HTTPConnectionPtr connection, HTTPRequestPtr request, int);
112
113void discardServer(HTTPServerPtr server);
114
115void listServers(FILE*);
Note: See TracBrowser for help on using the browser.