fielding 98/10/05 15:11:17
Modified: src CHANGES src/include httpd.h src/main http_protocol.c Log: Added new HTTP status codes and default response bodies from the revised HTTP/1.1 (307, 416, 417), WebDAV (102, 207, 422, 423), and HTTP Extension Framework (510) specifications. Did not add the WebDAV 424 and 425 codes because they are bogus. We don't use any of these codes yet, but they are now available to 3rd-party modules. Revision Changes Path 1.1102 +7 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1101 retrieving revision 1.1102 diff -u -r1.1101 -r1.1102 --- CHANGES 1998/10/05 17:48:42 1.1101 +++ CHANGES 1998/10/05 22:11:14 1.1102 @@ -1,5 +1,12 @@ Changes with Apache 1.3.3 + *) Added new HTTP status codes and default response bodies from the + revised HTTP/1.1 (307, 416, 417), WebDAV (102, 207, 422, 423), and + HTTP Extension Framework (510) specifications. Did not add the + WebDAV 424 and 425 codes because they are bogus. We don't use any + of these codes yet, but they are now available to 3rd-party modules. + [Roy Fielding] + *) Fix a possible race condition between timed-out requests and the ap_bhalfduplex select that might result in an infinite loop on platforms that do not validate the descriptor. [Roy Fielding] 1.245 +13 -1 apache-1.3/src/include/httpd.h Index: httpd.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v retrieving revision 1.244 retrieving revision 1.245 diff -u -r1.244 -r1.245 --- httpd.h 1998/09/21 19:44:12 1.244 +++ httpd.h 1998/10/05 22:11:16 1.245 @@ -443,10 +443,15 @@ /* ----------------------- HTTP Status Codes ------------------------- */ -#define RESPONSE_CODES 38 +/* The size of the static array in http_protocol.c for storing + * all of the potential response status-lines (a sparse table). + * A future version should dynamically generate the table at startup. + */ +#define RESPONSE_CODES 54 #define HTTP_CONTINUE 100 #define HTTP_SWITCHING_PROTOCOLS 101 +#define HTTP_PROCESSING 102 #define HTTP_OK 200 #define HTTP_CREATED 201 #define HTTP_ACCEPTED 202 @@ -454,12 +459,14 @@ #define HTTP_NO_CONTENT 204 #define HTTP_RESET_CONTENT 205 #define HTTP_PARTIAL_CONTENT 206 +#define HTTP_MULTI_STATUS 207 #define HTTP_MULTIPLE_CHOICES 300 #define HTTP_MOVED_PERMANENTLY 301 #define HTTP_MOVED_TEMPORARILY 302 #define HTTP_SEE_OTHER 303 #define HTTP_NOT_MODIFIED 304 #define HTTP_USE_PROXY 305 +#define HTTP_TEMPORARY_REDIRECT 307 #define HTTP_BAD_REQUEST 400 #define HTTP_UNAUTHORIZED 401 #define HTTP_PAYMENT_REQUIRED 402 @@ -476,6 +483,10 @@ #define HTTP_REQUEST_ENTITY_TOO_LARGE 413 #define HTTP_REQUEST_URI_TOO_LARGE 414 #define HTTP_UNSUPPORTED_MEDIA_TYPE 415 +#define HTTP_RANGE_NOT_SATISFIABLE 416 +#define HTTP_EXPECTATION_FAILED 417 +#define HTTP_UNPROCESSABLE_ENTITY 422 +#define HTTP_LOCKED 423 #define HTTP_INTERNAL_SERVER_ERROR 500 #define HTTP_NOT_IMPLEMENTED 501 #define HTTP_BAD_GATEWAY 502 @@ -483,6 +494,7 @@ #define HTTP_GATEWAY_TIME_OUT 504 #define HTTP_VERSION_NOT_SUPPORTED 505 #define HTTP_VARIANT_ALSO_VARIES 506 +#define HTTP_NOT_EXTENDED 510 #define DOCUMENT_FOLLOWS HTTP_OK #define PARTIAL_CONTENT HTTP_PARTIAL_CONTENT 1.242 +65 -26 apache-1.3/src/main/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v retrieving revision 1.241 retrieving revision 1.242 diff -u -r1.241 -r1.242 --- http_protocol.c 1998/09/25 22:45:00 1.241 +++ http_protocol.c 1998/10/05 22:11:16 1.242 @@ -988,7 +988,8 @@ static char *status_lines[] = { "100 Continue", "101 Switching Protocols", -#define LEVEL_200 2 + "102 Processing", +#define LEVEL_200 3 "200 OK", "201 Created", "202 Accepted", @@ -996,14 +997,17 @@ "204 No Content", "205 Reset Content", "206 Partial Content", -#define LEVEL_300 9 + "207 Multi-Status", +#define LEVEL_300 11 "300 Multiple Choices", "301 Moved Permanently", - "302 Moved Temporarily", + "302 Found", "303 See Other", "304 Not Modified", "305 Use Proxy", -#define LEVEL_400 15 + "306 unused", + "307 Temporary Redirect", +#define LEVEL_400 19 "400 Bad Request", "401 Authorization Required", "402 Payment Required", @@ -1020,14 +1024,26 @@ "413 Request Entity Too Large", "414 Request-URI Too Large", "415 Unsupported Media Type", -#define LEVEL_500 31 + "416 Requested Range Not Satisfiable", + "417 Expectation Failed", + "418 unused", + "419 unused", + "420 unused", + "421 unused", + "422 Unprocessable Entity", + "423 Locked", +#define LEVEL_500 43 "500 Internal Server Error", "501 Method Not Implemented", "502 Bad Gateway", "503 Service Temporarily Unavailable", "504 Gateway Time-out", "505 HTTP Version Not Supported", - "506 Variant Also Varies" + "506 Variant Also Negotiates" + "507 unused", + "508 unused", + "509 unused", + "510 Not Extended", }; /* The index is found by its offset from the x00 code of each level. @@ -2128,8 +2144,9 @@ NULL); switch (status) { - case REDIRECT: - case MOVED: + case HTTP_MOVED_PERMANENTLY: + case HTTP_MOVED_TEMPORARILY: + case HTTP_TEMPORARY_REDIRECT: ap_bvputs(fd, "The document has moved <A HREF=\"", ap_escape_html(r->pool, location), "\">here</A>.<P>\n", NULL); @@ -2237,35 +2254,57 @@ "the request exceeds the capacity limit.\n", NULL); break; case HTTP_REQUEST_URI_TOO_LARGE: - ap_bputs("The requested URL's length exceeds the capacity\n", fd); - ap_bputs("limit for this server.<P>\n", fd); + ap_bputs("The requested URL's length exceeds the capacity\n" + "limit for this server.<P>\n", fd); if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) { ap_bvputs(fd, error_notes, "<P>\n", NULL); } break; case HTTP_UNSUPPORTED_MEDIA_TYPE: - ap_bputs("The supplied request data is not in a format\n", fd); - ap_bputs("acceptable for processing by this resource.\n", fd); + ap_bputs("The supplied request data is not in a format\n" + "acceptable for processing by this resource.\n", fd); break; + case HTTP_RANGE_NOT_SATISFIABLE: + ap_bputs("None of the range-specifier values in the Range\n" + "request-header field overlap the current extent\n" + "of the selected resource.\n", fd); + break; + case HTTP_EXPECTATION_FAILED: + ap_bputs("The expectation given in the Expect request-header\n" + "field could not be met by this server.\n", fd); + break; + case HTTP_UNPROCESSABLE_ENTITY: + ap_bputs("The server understands the media type of the\n" + "request entity, but was unable to process the\n" + "contained instructions.\n", fd); + break; + case HTTP_LOCKED: + ap_bputs("The requested resource is currently locked.\n" + "The lock must be released or proper identification\n" + "given before the method can be applied.\n", fd); + break; case HTTP_SERVICE_UNAVAILABLE: - ap_bputs("The server is temporarily unable to service your\n", fd); - ap_bputs("request due to maintenance downtime or capacity\n", fd); - ap_bputs("problems. Please try again later.\n", fd); + ap_bputs("The server is temporarily unable to service your\n" + "request due to maintenance downtime or capacity\n" + "problems. Please try again later.\n", fd); break; case HTTP_GATEWAY_TIME_OUT: - ap_bputs("The proxy server did not receive a timely response\n", - fd); - ap_bputs("from the upstream server.<P>\n", fd); + ap_bputs("The proxy server did not receive a timely response\n" + "from the upstream server.\n", fd); + break; + case HTTP_NOT_EXTENDED: + ap_bputs("A mandatory extension policy in the request is not\n" + "accepted by the server for this resource.\n", fd); break; default: /* HTTP_INTERNAL_SERVER_ERROR */ - ap_bputs("The server encountered an internal error or\n", fd); - ap_bputs("misconfiguration and was unable to complete\n", fd); - ap_bputs("your request.<P>\n", fd); - ap_bputs("Please contact the server administrator,\n ", fd); - ap_bputs(ap_escape_html(r->pool, r->server->server_admin), fd); - ap_bputs(" and inform them of the time the error occurred,\n", fd); - ap_bputs("and anything you might have done that may have\n", fd); - ap_bputs("caused the error.<P>\n", fd); + ap_bvputs(fd, "The server encountered an internal error or\n" + "misconfiguration and was unable to complete\n" + "your request.<P>\n" + "Please contact the server administrator,\n ", + ap_escape_html(r->pool, r->server->server_admin), + " and inform them of the time the error occurred,\n" + "and anything you might have done that may have\n" + "caused the error.<P>\n", NULL); if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) { ap_bvputs(fd, error_notes, "<P>\n", NULL); }