| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | extern int serverExpireTime, dontCacheRedirects; |
|---|
| 24 | |
|---|
| 25 | typedef 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 | |
|---|
| 45 | extern AtomPtr parentHost; |
|---|
| 46 | extern int parentPort; |
|---|
| 47 | |
|---|
| 48 | void preinitServer(void); |
|---|
| 49 | void initServer(void); |
|---|
| 50 | |
|---|
| 51 | void httpServerAbortHandler(ObjectPtr object); |
|---|
| 52 | int httpMakeServerRequest(char *name, int port, ObjectPtr object, |
|---|
| 53 | int method, int from, int to, |
|---|
| 54 | HTTPRequestPtr requestor); |
|---|
| 55 | int httpServerQueueRequest(HTTPServerPtr server, HTTPRequestPtr request); |
|---|
| 56 | int httpServerTrigger(HTTPServerPtr server); |
|---|
| 57 | int httpServerSideRequest(HTTPServerPtr server); |
|---|
| 58 | int httpServerDoSide(HTTPConnectionPtr connection); |
|---|
| 59 | int httpServerSideHandler(int status, |
|---|
| 60 | FdEventHandlerPtr event, |
|---|
| 61 | StreamRequestPtr srequest); |
|---|
| 62 | int httpServerSideHandler2(int status, |
|---|
| 63 | FdEventHandlerPtr event, |
|---|
| 64 | StreamRequestPtr srequest); |
|---|
| 65 | int httpServerConnectionDnsHandler(int status, |
|---|
| 66 | GethostbynameRequestPtr request); |
|---|
| 67 | int httpServerConnectionHandler(int status, |
|---|
| 68 | FdEventHandlerPtr event, |
|---|
| 69 | ConnectRequestPtr request); |
|---|
| 70 | int httpServerSocksHandler(int status, SocksRequestPtr request); |
|---|
| 71 | int httpServerConnectionHandlerCommon(int status, |
|---|
| 72 | HTTPConnectionPtr connection); |
|---|
| 73 | void httpServerFinish(HTTPConnectionPtr connection, int s, int offset); |
|---|
| 74 | |
|---|
| 75 | void httpServerReply(HTTPConnectionPtr connection, int immediate); |
|---|
| 76 | void httpServerAbort(HTTPConnectionPtr connection, int, int, struct _Atom *); |
|---|
| 77 | void httpServerAbortRequest(HTTPRequestPtr request, int, int, struct _Atom *); |
|---|
| 78 | void httpServerClientReset(HTTPRequestPtr request); |
|---|
| 79 | void httpServerUnpipeline(HTTPRequestPtr request); |
|---|
| 80 | int |
|---|
| 81 | httpServerSendRequest(HTTPConnectionPtr connection); |
|---|
| 82 | int |
|---|
| 83 | httpServerHandler(int status, |
|---|
| 84 | FdEventHandlerPtr event, |
|---|
| 85 | StreamRequestPtr request); |
|---|
| 86 | int |
|---|
| 87 | httpServerReplyHandler(int status, |
|---|
| 88 | FdEventHandlerPtr event, |
|---|
| 89 | StreamRequestPtr request); |
|---|
| 90 | int |
|---|
| 91 | httpServerIndirectHandler(int status, |
|---|
| 92 | FdEventHandlerPtr event, |
|---|
| 93 | StreamRequestPtr request); |
|---|
| 94 | int |
|---|
| 95 | httpServerDirectHandler(int status, |
|---|
| 96 | FdEventHandlerPtr event, |
|---|
| 97 | StreamRequestPtr request); |
|---|
| 98 | int |
|---|
| 99 | httpServerDirectHandler2(int status, |
|---|
| 100 | FdEventHandlerPtr event, |
|---|
| 101 | StreamRequestPtr request); |
|---|
| 102 | int httpServerRequest(ObjectPtr object, int method, int from, int to, |
|---|
| 103 | HTTPRequestPtr, void*); |
|---|
| 104 | int httpServerHandlerHeaders(int eof, |
|---|
| 105 | FdEventHandlerPtr event, |
|---|
| 106 | StreamRequestPtr request, |
|---|
| 107 | HTTPConnectionPtr connection); |
|---|
| 108 | int httpServerReadData(HTTPConnectionPtr, int); |
|---|
| 109 | int connectionAddData(HTTPConnectionPtr connection, int skip); |
|---|
| 110 | int |
|---|
| 111 | httpWriteRequest(HTTPConnectionPtr connection, HTTPRequestPtr request, int); |
|---|
| 112 | |
|---|
| 113 | void discardServer(HTTPServerPtr server); |
|---|
| 114 | |
|---|
| 115 | void listServers(FILE*); |
|---|