Update of /cvsroot/mod-xhtml-neg/mod_xhtml_neg
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6354
Modified Files:
mod_xhtml_neg.c
Log Message:
ETag processing now working as intended.
Index: mod_xhtml_neg.c
===================================================================
RCS file: /cvsroot/mod-xhtml-neg/mod_xhtml_neg/mod_xhtml_neg.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** mod_xhtml_neg.c 11 Mar 2004 12:04:53 -0000 1.9
--- mod_xhtml_neg.c 11 Mar 2004 12:22:39 -0000 1.10
***************
*** 79,83 ****
* 0.7 Added profile handling, fixed up default charset for text/xml
* 0.8 First public release.
! * 0.82 Development of Etag handling.
*
* Todo:
--- 79,83 ----
* 0.7 Added profile handling, fixed up default charset for text/xml
* 0.8 First public release.
! * 0.9 ETag handled correctly for different content types.
*
* Todo:
***************
*** 458,462 ****
}
! static char *construct_new_etag( pool *p, int index )
{
return ap_psprintf( p, "\"mxn-%d\"", index );
--- 458,467 ----
}
! /*
! * Construct an Etag suffix to be appended to the standard Apache
! * ETag.
! */
!
! static char *construct_etag_suffix( pool *p, int index )
{
return ap_psprintf( p, "\"mxn-%d\"", index );
***************
*** 825,829 ****
static char *best_match(pool *p, array_header *accept_type,
array_header *content_type, array_header *accept_charset,
! int stars_to_match, xhtml_neg_state *xns)
{
float best_q = 0.0f;
--- 830,835 ----
static char *best_match(pool *p, array_header *accept_type,
array_header *content_type, array_header *accept_charset,
! int stars_to_match, xhtml_neg_state *xns,
! int *result_index)
{
float best_q = 0.0f;
***************
*** 837,840 ****
--- 843,849 ----
char *logmessage;
+ /* Set result index to 0 initially. */
+ *result_index = 0;
+
/* Deal with silly null pointers when Accept: header is empty */
if((content_type == NULL) || (accept_type == NULL)) {
***************
*** 891,894 ****
--- 900,904 ----
best_stars = curr_stars;
best_type = curr_content;
+ *result_index = i + 1;
}
}
***************
*** 948,951 ****
--- 958,962 ----
extension_rec *item;
table *hdrs;
+ int *result_index;
conf = (xhtml_dir_config *) ap_get_module_config(
***************
*** 1036,1042 ****
accept_charsets = do_accept_charset_line(r->pool, accept_charset);
result_type = best_match( r->pool, accept_types, content_types,
accept_charsets, conf->stars_ignore,
! xns );
if( result_type != NULL ) {
--- 1047,1055 ----
accept_charsets = do_accept_charset_line(r->pool, accept_charset);
+ /* Allocate storage for index of result, used in Etag. */
+ result_index = (int *) ap_palloc( r->pool, sizeof(int));
result_type = best_match( r->pool, accept_types, content_types,
accept_charsets, conf->stars_ignore,
! xns, result_index );
if( result_type != NULL ) {
***************
*** 1045,1049 ****
* by Apache.
*/
! char *new_etag = construct_new_etag( r->pool, 4 );
r->vlist_validator = new_etag;
r->content_type = result_type;
--- 1058,1062 ----
* by Apache.
*/
! char *new_etag = construct_etag_suffix( r->pool, *result_index );
r->vlist_validator = new_etag;
r->content_type = result_type;
|