[mod-xhtml-neg-cvs] mod_xhtml_neg mod_xhtml_neg.c,1.28,1.29
Brought to you by:
run2000
From: <ru...@us...> - 2004-03-28 06:08:27
|
Update of /cvsroot/mod-xhtml-neg/mod_xhtml_neg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32203 Modified Files: mod_xhtml_neg.c Log Message: Resync with 2.0 codebase to avoid code drift. Index: mod_xhtml_neg.c =================================================================== RCS file: /cvsroot/mod-xhtml-neg/mod_xhtml_neg/mod_xhtml_neg.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** mod_xhtml_neg.c 26 Mar 2004 10:57:46 -0000 1.28 --- mod_xhtml_neg.c 28 Mar 2004 05:57:05 -0000 1.29 *************** *** 92,97 **** * @c XhtmlNegTypes A file extension followed by one or more matching * content-type strings \n ! * @c XhtmlNegStarsIgnore The number of stars in an Accept token which ! * should be ignored if we match them \n * @c XhtmlNegCache Should negotiated HTTP 1.0 requests be cacheable? * Defaults to no \n --- 92,97 ---- * @c XhtmlNegTypes A file extension followed by one or more matching * content-type strings \n ! * @c XhtmlNegStarsIgnore The number of stars in an Accept token which should ! * be ignored if we match them \n * @c XhtmlNegCache Should negotiated HTTP 1.0 requests be cacheable? * Defaults to no \n *************** *** 134,137 **** --- 134,138 ---- /** The default HTTP character set for most content types. */ #define DEFAULT_CHARSET_NAME "iso-8859-1" + /** The default HTTP character set for text/xml and text/xml-external-entity * content types. */ *************** *** 173,180 **** */ typedef struct { ! char *fname; /**< Name of the log file we write to, if any */ ! int log_fd; /**< File descriptor of the log file, or -1 */ ! http_caching cache; /**< Flag to cache negotiated content in ! * HTTP 1.0 requests */ } xhtml_neg_state; --- 174,181 ---- */ typedef struct { ! char *fname; /**< Name of the log file we write to, if any */ ! int log_fd; /**< File descriptor of the log file, or -1 */ ! http_caching cache; /**< Flag to cache negotiated content in ! * HTTP 1.0 requests */ } xhtml_neg_state; *************** *** 210,215 **** */ typedef struct { ! char *extension; /**< Filename extension */ ! array_header *content_types; /**< Array of content accept tokens */ } extension_rec; --- 211,216 ---- */ typedef struct { ! char *extension; /**< Filename extension */ ! array_header *content_types; /**< Array of content accept tokens */ } extension_rec; *************** *** 696,739 **** static char *merge_validators(pool *p, char *old_variant, char *new_variant) { - char *etag; int old_weak, new_weak; if (mod_xhtml_strempty(old_variant)) { ! etag = new_variant; } else if (mod_xhtml_strempty(new_variant)) { ! etag = old_variant; ! } else { ! /* Merge any two vlist entries: one from any previous module, and ! * one from the current module. This merging makes revalidation ! * somewhat safer, ensures that caches which can deal with ! * Vary will (eventually) be updated if the set of variants is ! * changed, and is also a protocol requirement for transparent ! * content negotiation. ! */ ! /* if the variant list validator is weak, we make the whole ! * structured etag weak. If we would not, then clients could ! * have problems merging range responses if we have different ! * variants with the same non-globally-unique strong etag. ! */ ! old_weak = (old_variant[0] == 'W'); ! new_weak = (new_variant[0] == 'W'); ! /* merge old and new variant_etags into a structured etag */ ! old_variant[strlen(old_variant) - 1] = '\0'; ! if (new_weak) ! new_variant += 3; ! else ! new_variant++; ! if((old_weak == 0) && (new_weak != 0)) { ! etag = ap_pstrcat(p, "W/", old_variant, ";", new_variant, NULL); ! } else { ! etag = ap_pstrcat(p, old_variant, ";", new_variant, NULL); ! } } ! return etag; } --- 697,736 ---- static char *merge_validators(pool *p, char *old_variant, char *new_variant) { int old_weak, new_weak; if (mod_xhtml_strempty(old_variant)) { ! return new_variant; } else if (mod_xhtml_strempty(new_variant)) { ! return old_variant; ! } ! /* Merge any two vlist entries: one from any previous module, and ! * one from the current module. This merging makes revalidation ! * somewhat safer, ensures that caches which can deal with ! * Vary will (eventually) be updated if the set of variants is ! * changed, and is also a protocol requirement for transparent ! * content negotiation. ! */ ! /* if the variant list validator is weak, we make the whole ! * structured etag weak. If we would not, then clients could ! * have problems merging range responses if we have different ! * variants with the same non-globally-unique strong etag. ! */ ! old_weak = (old_variant[0] == 'W'); ! new_weak = (new_variant[0] == 'W'); ! /* merge old and new variant_etags into a structured etag */ ! old_variant[mod_xhtml_strlen(old_variant) - 1] = '\0'; ! if ((new_weak) && (mod_xhtml_strlen(new_variant) > 3)) ! new_variant += 3; ! else ! new_variant++; ! if((old_weak == 0) && (new_weak != 0)) { ! return ap_pstrcat(p, "W/", old_variant, ";", new_variant, NULL); } ! return ap_pstrcat(p, old_variant, ";", new_variant, NULL); } *************** *** 1391,1401 **** if( result_rec != NULL ) { ! /* Construct a "suffix" for the ETag, and make sure it gets * appended to the ETag that would normally be returned * by Apache. */ r->vlist_validator = merge_validators( r->pool, r->vlist_validator, result_rec->hashcode ); - r->content_type = reconstruct_content_type( r->pool, result_rec ); if( xns->log_fd > 0 ) { --- 1388,1398 ---- if( result_rec != NULL ) { ! /* Construct a new ETag suffix, and make sure it gets * appended to the ETag that would normally be returned * by Apache. */ + r->content_type = reconstruct_content_type( r->pool, result_rec ); r->vlist_validator = merge_validators( r->pool, r->vlist_validator, result_rec->hashcode ); if( xns->log_fd > 0 ) { |