| [9] | 1 | /* http.h
|
|---|
| 2 | *
|
|---|
| 3 | * This file is part of httpd.
|
|---|
| 4 | *
|
|---|
| 5 | * 02/17/1996 Michael Temari <Michael@TemWare.Com>
|
|---|
| 6 | * 07/07/1996 Initial Release Michael Temari <Michael@TemWare.Com>
|
|---|
| 7 | * 12/29/2002 Michael Temari <Michael@TemWare.Com>
|
|---|
| 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | #define INDEX_FILE_NAME "index.html"
|
|---|
| 12 |
|
|---|
| 13 | #define HTTP_REQUEST_TYPE_SIMPLE 0
|
|---|
| 14 | #define HTTP_REQUEST_TYPE_FULL 1
|
|---|
| 15 | #define HTTP_REQUEST_TYPE_PROXY 2
|
|---|
| 16 |
|
|---|
| 17 | #define HTTP_METHOD_UNKNOWN 0
|
|---|
| 18 | #define HTTP_METHOD_OPTIONS 1
|
|---|
| 19 | #define HTTP_METHOD_GET 2
|
|---|
| 20 | #define HTTP_METHOD_HEAD 3
|
|---|
| 21 | #define HTTP_METHOD_POST 4
|
|---|
| 22 | #define HTTP_METHOD_PUT 5
|
|---|
| 23 | #define HTTP_METHOD_PATCH 6
|
|---|
| 24 | #define HTTP_METHOD_COPY 7
|
|---|
| 25 | #define HTTP_METHOD_MOVE 8
|
|---|
| 26 | #define HTTP_METHOD_DELETE 9
|
|---|
| 27 | #define HTTP_METHOD_LINK 10
|
|---|
| 28 | #define HTTP_METHOD_UNLINK 11
|
|---|
| 29 | #define HTTP_METHOD_TRACE 12
|
|---|
| 30 | #define HTTP_METHOD_WRAPPED 13
|
|---|
| 31 |
|
|---|
| 32 | #define HTTP_STATUS_OK 200
|
|---|
| 33 | #define HTTP_STATUS_CREATED 201
|
|---|
| 34 | #define HTTP_STATUS_ACCEPTED 202
|
|---|
| 35 | #define HTTP_STATUS_NO_CONTENT 204
|
|---|
| 36 | #define HTTP_STATUS_MOVED_PERM 301
|
|---|
| 37 | #define HTTP_STATUS_MOVED_TEMP 302
|
|---|
| 38 | #define HTTP_STATUS_NOT_MODIFIED 304
|
|---|
| 39 | #define HTTP_STATUS_USE_PROXY 305
|
|---|
| 40 | #define HTTP_STATUS_BAD_REQUEST 400
|
|---|
| 41 | #define HTTP_STATUS_UNAUTHORIZED 401
|
|---|
| 42 | #define HTTP_STATUS_FORBIDDEN 403
|
|---|
| 43 | #define HTTP_STATUS_NOT_FOUND 404
|
|---|
| 44 | #define HTTP_STATUS_METHOD_NOT_ALLOWED 405
|
|---|
| 45 | #define HTTP_STATUS_PROXY_AUTH_REQRD 407
|
|---|
| 46 | #define HTTP_STATUS_LENGTH_REQUIRED 411
|
|---|
| 47 | #define HTTP_STATUS_SERVER_ERROR 500
|
|---|
| 48 | #define HTTP_STATUS_NOT_IMPLEMENTED 501
|
|---|
| 49 | #define HTTP_STATUS_BAD_GATEWAY 502
|
|---|
| 50 | #define HTTP_STATUS_SERVICE_UNAVAILABLE 503
|
|---|
| 51 | #define HTTP_STATUS_GATEWAY_TIMEOUT 504
|
|---|
| 52 | #define HTTP_STATUS_UNSUPPORTED_VERSION 505
|
|---|
| 53 |
|
|---|
| 54 | struct http_request {
|
|---|
| 55 | int type;
|
|---|
| 56 | int method;
|
|---|
| 57 | char uri[256];
|
|---|
| 58 | char url[256];
|
|---|
| 59 | char query[256];
|
|---|
| 60 | char host[256];
|
|---|
| 61 | int port;
|
|---|
| 62 | char useragent[256];
|
|---|
| 63 | int vmajor;
|
|---|
| 64 | int vminor;
|
|---|
| 65 | time_t ifmodsince;
|
|---|
| 66 | off_t size;
|
|---|
| 67 | time_t msgdate;
|
|---|
| 68 | int keepopen;
|
|---|
| 69 | char wwwauth[128];
|
|---|
| 70 | char authuser[128];
|
|---|
| 71 | char authpass[128];
|
|---|
| 72 | char cookie[128];
|
|---|
| 73 | };
|
|---|
| 74 |
|
|---|
| 75 | struct http_reply {
|
|---|
| 76 | int status;
|
|---|
| 77 | char statusmsg[128];
|
|---|
| 78 | int keepopen;
|
|---|
| 79 | int headers;
|
|---|
| 80 | char *mtype;
|
|---|
| 81 | char realurl[256];
|
|---|
| 82 | struct auth *auth;
|
|---|
| 83 | int urlaccess;
|
|---|
| 84 | off_t size;
|
|---|
| 85 | time_t modtime;
|
|---|
| 86 | int fd;
|
|---|
| 87 | int ofd;
|
|---|
| 88 | int pid;
|
|---|
| 89 | };
|
|---|
| 90 |
|
|---|
| 91 | /* from httpd.c */
|
|---|
| 92 |
|
|---|
| 93 | extern FILE *stdlog;
|
|---|
| 94 | extern FILE *dbglog;
|
|---|
| 95 |
|
|---|
| 96 | /* from reply.c */
|
|---|
| 97 |
|
|---|
| 98 | _PROTOTYPE(int sendreply, (struct http_reply *rp, struct http_request *rq));
|
|---|
| 99 |
|
|---|
| 100 | /* from request.c */
|
|---|
| 101 |
|
|---|
| 102 | _PROTOTYPE(int getrequest, (struct http_request *rq));
|
|---|
| 103 |
|
|---|
| 104 | /* from process.c */
|
|---|
| 105 |
|
|---|
| 106 | _PROTOTYPE(int processrequest, (struct http_request *rq, struct http_reply *rp));
|
|---|
| 107 |
|
|---|
| 108 | /* from police.c */
|
|---|
| 109 |
|
|---|
| 110 | _PROTOTYPE(int police, (struct http_request *rq, struct http_reply *rp));
|
|---|
| 111 |
|
|---|
| 112 | /* from cgiexec.c */
|
|---|
| 113 |
|
|---|
| 114 | _PROTOTYPE(int cgiexec, (struct http_request *rq, struct http_reply *rp));
|
|---|
| 115 |
|
|---|
| 116 | /* from proxy.c */
|
|---|
| 117 |
|
|---|
| 118 | _PROTOTYPE(void proxy, (struct http_request *rq, struct http_reply *rp));
|
|---|