From a453662fc71e9bfc4c649f3069858cb04fdefccc Mon Sep 17 00:00:00 2001 From: hno <> Date: Fri, 7 Sep 2001 01:51:56 +0000 Subject: [PATCH] 2.5 bugfix: header_access failed to remove headers if there was no replacement set by header_replace. Caused by lack of braces around if/else blocks. Reported with a patch by Andres Kroonmaa --- src/HttpHeaderTools.cc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index 1063688b3d..a7c27e011e 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.cc,v 1.31 2001/02/07 18:56:51 hno Exp $ + * $Id: HttpHeaderTools.cc,v 1.32 2001/09/06 19:51:56 hno Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -413,16 +413,20 @@ httpHdrMangle(HttpHeaderEntry * e, request_t * request) assert(e); hm = &Config.header_access[e->id]; checklist = aclChecklistCreate(hm->access_list, request, NULL); - /* aclCheckFast returns 1 for allow. */ - if (1 == aclCheckFast(hm->access_list, checklist)) + if (1 == aclCheckFast(hm->access_list, checklist)) { + /* aclCheckFast returns 1 for allow. */ retval = 1; - /* It was denied; Do we replace it with something else? */ - else if (NULL == hm->replacement) + } else if (NULL == hm->replacement) { + /* It was denied, and we don't have any replacement */ retval = 0; - /* yes, we do */ - else + } else { + /* It was denied, but we have a replacement. Replace the + * header on the fly, and return that the new header + * is allowed. + */ stringReset(&e->value, hm->replacement); - retval = 1; + retval = 1; + } aclChecklistFree(checklist); return retval; -- 2.47.2