You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by je...@apache.org on 2003/04/22 23:52:47 UTC
cvs commit: httpd-2.0/modules/dav/main util.c
jerenkrantz 2003/04/22 14:52:46
Modified: modules/dav/main util.c
Log:
Fix a typo in the weak entity check. The prefix is W/" not "W/.
Revision Changes Path
1.48 +6 -8 httpd-2.0/modules/dav/main/util.c
Index: util.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/dav/main/util.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -u -r1.47 -r1.48
--- util.c 3 Feb 2003 17:52:58 -0000 1.47
+++ util.c 22 Apr 2003 21:52:46 -0000 1.48
@@ -1079,23 +1079,21 @@
/* Do a weak entity comparison function as defined in
* RFC 2616 13.3.3.
*/
- if (state_list->etag[0] == '"' &&
- state_list->etag[1] == 'W' &&
- state_list->etag[2] == '/') {
+ if (state_list->etag[0] == 'W' &&
+ state_list->etag[1] == '/' &&
+ state_list->etag[2] == '"') {
new_etag = apr_pstrdup(p, state_list->etag);
new_etag += 2;
- new_etag[0] = '"';
given_etag = new_etag;
}
else {
given_etag = state_list->etag;
}
- if (etag[0] == '"' &&
- etag[1] == 'W' &&
- etag[2] == '/') {
+ if (etag[0] == 'W' &&
+ etag[1] == '/' &&
+ etag[2] == '"') {
new_etag = apr_pstrdup(p, etag);
new_etag += 2;
- new_etag[0] = '"';
current_etag = new_etag;
}
else {
Re: cvs commit: httpd-2.0/modules/dav/main util.c
Posted by Joe Orton <jo...@manyfish.co.uk>.
On Tue, Apr 22, 2003 at 09:52:47PM -0000, Justin Erenkrantz wrote:
> jerenkrantz 2003/04/22 14:52:46
>
> Modified: modules/dav/main util.c
> Log:
> Fix a typo in the weak entity check. The prefix is W/" not "W/.
This code can be simplified to avoid the strdups:
Index: modules/dav/main/util.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/dav/main/util.c,v
retrieving revision 1.48
diff -u -r1.48 util.c
--- modules/dav/main/util.c 22 Apr 2003 21:52:46 -0000 1.48
+++ modules/dav/main/util.c 24 Apr 2003 09:45:11 -0000
@@ -1072,33 +1072,18 @@
switch(state_list->type) {
case dav_if_etag:
{
- const char *given_etag, *current_etag;
- char *new_etag;
+ const char *given_etag = state_list->etag;
+ const char *current_etag = etag;
int mismatch;
/* Do a weak entity comparison function as defined in
* RFC 2616 13.3.3.
*/
- if (state_list->etag[0] == 'W' &&
- state_list->etag[1] == '/' &&
- state_list->etag[2] == '"') {
- new_etag = apr_pstrdup(p, state_list->etag);
- new_etag += 2;
- given_etag = new_etag;
- }
- else {
- given_etag = state_list->etag;
- }
- if (etag[0] == 'W' &&
- etag[1] == '/' &&
- etag[2] == '"') {
- new_etag = apr_pstrdup(p, etag);
- new_etag += 2;
- current_etag = new_etag;
- }
- else {
- current_etag = etag;
- }
+ if (given_etag[0] == 'W' && given_etag[1] == '/')
+ given_etag += 2;
+
+ if (current_etag[0] == 'W' && current_etag[1] == '/')
+ current_etag += 2;
mismatch = strcmp(given_etag, current_etag);