[mod-xhtml-neg-cvs] mod_xhtml_neg mod_xhtml_neg.c,1.7,1.8
Brought to you by:
run2000
From: <ru...@us...> - 2004-03-11 10:18:38
|
Update of /cvsroot/mod-xhtml-neg/mod_xhtml_neg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10476 Modified Files: mod_xhtml_neg.c Log Message: Added simple ETag parsing. Index: mod_xhtml_neg.c =================================================================== RCS file: /cvsroot/mod-xhtml-neg/mod_xhtml_neg/mod_xhtml_neg.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mod_xhtml_neg.c 9 Mar 2004 10:20:27 -0000 1.7 --- mod_xhtml_neg.c 11 Mar 2004 09:52:02 -0000 1.8 *************** *** 585,588 **** --- 585,645 ---- /* + * Following code modified from mod_negotiate.c + * + * Get a single ETag entry --- one quoted string with optional + * "weak" prefix. + */ + + static const char *get_etag(pool *p, etag_rec *result, + const char *accept_line) + { + char *token, *end; + + result->weak = 0; + result->etag = ""; + + /* + * Note that this handles the format: + * + * If-None-Match: "etag-1", W/"etag2", "etag3" + * + * If the token begins with a "W/", we're looking at a weak + * mnodifier, otherwise we parse the quoted ETag immediately + */ + + token = ap_get_token(p, &accept_line, 0); + + if( *token == 'W' || *token == 'w' ) { + ++token; + result->weak = 1; + /* Skip the slash */ + if( *token != '\0' ) { + ++token; + } + } + + if (*token == '"') { + ++token; + for (end = token; + (*end && *end != '\n' && *end != '\r' && *end != '\"'); + end++); + } else { + for (end = token; (*end && !ap_isspace(*end)); end++); + } + if (*end) { + *end = '\0'; /* strip ending quote or return */ + } + + /** Assign the ETag to the parsed token */ + result->etag = token; + + if (*accept_line == ',') { + ++accept_line; + } + + return accept_line; + } + + /* * Dealing with Accept header lines ... * |