cvs commit: apache/src http_protocol.c httpd.h mod_negotiation.c CHANGES
mjc 96/09/24 05:45:04 Modified:src http_protocol.c httpd.h mod_negotiation.c CHANGES Log: Submitted by: Paul Sutton [EMAIL PROTECTED] Reviewed by: Mark Cox, Alexei Kosut, Roy Fielding, Brian Behlendorf Negotiation updated to implement all aspects of HTTP/1.1, including charset and encoding negotiation. Some code included for transparent negotiation (not compiled in by default). Revision ChangesPath 1.47 +20 -4 apache/src/http_protocol.c Index: http_protocol.c === RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C3 -r1.46 -r1.47 *** http_protocol.c 1996/09/17 14:53:54 1.46 --- http_protocol.c 1996/09/24 12:44:57 1.47 *** *** 50,56 * */ ! /* $Id: http_protocol.c,v 1.46 1996/09/17 14:53:54 chuck Exp $ */ /* * http_protocol.c --- routines which directly communicate with the --- 50,56 * */ ! /* $Id: http_protocol.c,v 1.47 1996/09/24 12:44:57 mjc Exp $ */ /* * http_protocol.c --- routines which directly communicate with the *** *** 793,799 return OK; } ! #define RESPONSE_CODE_LIST 200 206 301 302 304 400 401 403 404 405 406 411 412 500 503 501 502 /* New Apache routine to map error responses into array indicies * e.g. 400 - 0, 500 - 1, 502 - 2 ... --- 793,799 return OK; } ! #define RESPONSE_CODE_LIST 200 206 300 301 302 304 400 401 403 404 405 406 411 412 500 503 501 502 506 /* New Apache routine to map error responses into array indicies * e.g. 400 - 0, 500 - 1, 502 - 2 ... *** *** 803,808 --- 803,809 char *status_lines[] = { 200 OK, 206 Partial Content, +300 Multiple Choices, 301 Moved Permanently, 302 Found, 304 Not Modified, *** *** 817,828 500 Server error, 503 Out of resources, 501 Not Implemented, !502 Bad Gateway }; char *response_titles[] = { 200 OK,/* Never actually sent, barring die(200,...) */ 206 Partial Content, /* Never sent as an error (we hope) */ Document moved,/* 301 Redirect */ Document moved,/* 302 Redirect */ 304 Not Modified, /* Never sent... 304 MUST be header only */ --- 818,831 500 Server error, 503 Out of resources, 501 Not Implemented, !502 Bad Gateway, !506 Variant Also Varies }; char *response_titles[] = { 200 OK,/* Never actually sent, barring die(200,...) */ 206 Partial Content, /* Never sent as an error (we hope) */ +Multiple Choices, /* 300 Multiple Choices */ Document moved,/* 301 Redirect */ Document moved,/* 302 Redirect */ 304 Not Modified, /* Never sent... 304 MUST be header only */ *** *** 837,843 Server Error, Out of resources, Method not implemented, !Bad Gateway }; int index_of_response(int err_no) { --- 840,847 Server Error, Out of resources, Method not implemented, !Bad Gateway, !Variant Also Varies }; int index_of_response(int err_no) { *** *** 1361,1366 --- 1365,1377 bvputs(fd, An appropriate variant to the requested entity , escape_html(r-pool, r-uri), could not be found on this server.P\n, NULL); + /* fall through */ + case MULTIPLE_CHOICES: + { + char *list; + if (list = table_get (r-notes, variant-list)) + bputs(list, fd); + } break; case LENGTH_REQUIRED: bvputs(fd, A request of the requested method , r-method, *** *** 1389,1394 --- 1400,1410 bputs(The proxy server received an invalid\015\012, fd); bputs(response from an upstream server.P\015\012, fd); break; + case VARIANT_ALSO_VARIES: + bvputs(fd, A variant for the requested entity , +escape_html(r-pool, r-uri), is itself a , +transparently negotiable resource.P\n, NULL); + break; } if (recursive_error) { 1.50 +4 -2 apache/src/httpd.h Index: httpd.h === RCS file: /export/home/cvs/apache/src/httpd.h,v retrieving revision 1.49 retrieving revision 1.50 diff -C3 -r1.49 -r1.50 *** httpd.h
cvs commit: apache/src http_protocol.c httpd.h mod_negotiation.c
akosut 96/08/15 12:22:41 Modified:src http_protocol.c httpd.h mod_negotiation.c Log: Send 406 instead of 404 response when an acceptable variant is not found. Revision ChangesPath 1.36 +8 -1 apache/src/http_protocol.c Index: http_protocol.c === RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C3 -r1.35 -r1.36 *** http_protocol.c 1996/08/07 01:27:57 1.35 --- http_protocol.c 1996/08/15 19:22:34 1.36 *** *** 760,766 return OK; } ! #define RESPONSE_CODE_LIST 200 206 301 302 304 400 401 403 404 405 411 412 500 503 501 502 /* New Apache routine to map error responses into array indicies * e.g. 400 - 0, 500 - 1, 502 - 2 ... --- 760,766 return OK; } ! #define RESPONSE_CODE_LIST 200 206 301 302 304 400 401 403 404 405 406 411 412 500 503 501 502 /* New Apache routine to map error responses into array indicies * e.g. 400 - 0, 500 - 1, 502 - 2 ... *** *** 778,783 --- 778,784 403 Forbidden, 404 Not found, 405 Method Not Allowed, +406 Not Acceptable, 411 Length Required, 412 Precondition Failed, 500 Server error, *** *** 797,802 --- 798,804 Forbidden, File Not found, Method Not Allowed, +Not Acceptable, Length Required, Precondition Failed, Server Error, *** *** 1328,1333 --- 1330,1340 bvputs(fd, The requested method , r-method, is not allowed for the URL , escape_html(r-pool, r-uri), .P\n, NULL); + break; + case NOT_ACCEPTABLE: + bvputs(fd, An appropriate variant to the requested entity , +escape_html(r-pool, r-uri), could not be found +on this server.P\n, NULL); break; case LENGTH_REQUIRED: bvputs(fd, A request of the requested method , r-method, 1.45 +2 -1 apache/src/httpd.h Index: httpd.h === RCS file: /export/home/cvs/apache/src/httpd.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C3 -r1.44 -r1.45 *** httpd.h 1996/08/07 01:27:58 1.44 --- httpd.h 1996/08/15 19:22:37 1.45 *** *** 263,275 #define FORBIDDEN 403 #define NOT_FOUND 404 #define METHOD_NOT_ALLOWED 405 #define LENGTH_REQUIRED 411 #define PRECONDITION_FAILED 412 #define SERVER_ERROR 500 #define NOT_IMPLEMENTED 501 #define BAD_GATEWAY 502 #define HTTP_SERVICE_UNAVAILABLE 503 ! #define RESPONSE_CODES 15 #define METHODS 8 #define M_GET 0 --- 263,276 #define FORBIDDEN 403 #define NOT_FOUND 404 #define METHOD_NOT_ALLOWED 405 + #define NOT_ACCEPTABLE 406 #define LENGTH_REQUIRED 411 #define PRECONDITION_FAILED 412 #define SERVER_ERROR 500 #define NOT_IMPLEMENTED 501 #define BAD_GATEWAY 502 #define HTTP_SERVICE_UNAVAILABLE 503 ! #define RESPONSE_CODES 16 #define METHODS 8 #define M_GET 0 1.13 +2 -10 apache/src/mod_negotiation.c Index: mod_negotiation.c === RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C3 -r1.12 -r1.13 *** mod_negotiation.c 1996/08/15 18:36:42 1.12 --- mod_negotiation.c 1996/08/15 19:22:38 1.13 *** *** 127,138 { NULL } }; - /* - * TO DO --- error code 406. Unfortunately, the specification for - * a 406 reply in the current draft standard is unworkable; - * we return 404 for these pending a workable spec. - */ - /* Record of available info on a media type specified by the client * (we also use 'em for encodings and languages) */ --- 127,132 *** *** 1079,1087 maybe_add_default_encodings(neg, 0); if (!(best = best_match(neg))) { - /* Should be a 406 */ log_reason (no acceptable variant, r-filename, r); ! return NOT_FOUND; } /* Make sure caching works - Vary should handle HTTP/1.1, but for --- 1073,1080 maybe_add_default_encodings(neg, 0); if (!(best = best_match(neg))) { log_reason (no acceptable variant, r-filename, r); ! return NOT_ACCEPTABLE; } /* Make sure caching works - Vary should handle HTTP/1.1, but for *** *** 1121,1129 if (neg-avail_vars-nelts == 0) return