You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 2000/01/11 18:11:40 UTC

Re: cvs commit: apache-1.3/src/modules/standard mod_mime.c

In article <20...@hyperreal.org> you wrote:
> ben         00/01/11 06:13:50
> 
>   Modified:    src      CHANGES
>                src/include httpd.h
>                src/main http_core.c http_protocol.c http_request.c
>                src/modules/proxy mod_proxy.c mod_proxy.h proxy_ftp.c
>                         proxy_http.c proxy_util.c
>                src/modules/standard mod_mime.c
>   Log:
>   Don't convert auth to proxy auth when it shouldn't be.

Was this really reviewed and already approved for 1.3 by Jim?
I'm +1 for the change, but IMHO it's incomplete:

| :> grep proxyreq *.c
| mod_digest.c:                                    r->proxyreq ?
| "Proxy-Authorization"
| mod_mime.c:         && r->proxyreq == NOT_PROXY) {
| mod_rewrite.c:            r->proxyreq = 1;
| mod_rewrite.c:            r->proxyreq = 1;
| mod_speling.c:    if (r->proxyreq || (r->finfo.st_mode != 0)) {

Although it still works because of the enum's actual values, mod_digest,
mod_speling and mod_rewrite should be updated, too. At least I find it
unclean to use an enum value still in a boolean context. 

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Re: cvs commit: apache-1.3/src/modules/standard mod_mime.c

Posted by Ben Laurie <be...@algroup.co.uk>.
Tony Finch wrote:
> 
> Ben Laurie <be...@algroup.co.uk> wrote:
> >"Ralf S. Engelschall" wrote:
> >>
> >> Although it still works because of the enum's actual values, mod_digest,
> >> mod_speling and mod_rewrite should be updated, too. At least I find it
> >> unclean to use an enum value still in a boolean context.
> >
> >Indeed. I designed it so that third-party modules would continue to
> >work, and this applies equally to the ones I missed. They should be
> >fixed, of course.
> 
> Is this right? It's not quite the same as leaving things as they are
> for the digest modules.

I guess its not possible to fix a bug in proxy auth transparently for
things that actually _do_ proxy auth! Sorry 'bout that. Guess you should
commit (after testing, of course).

Cheers,

Ben.

--
SECURE HOSTING AT THE BUNKER! http://www.thebunker.net/hosting.htm

http://www.apache-ssl.org/ben.html

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

Re: cvs commit: apache-1.3/src/modules/standard mod_mime.c

Posted by Tony Finch <do...@dotat.at>.
Ben Laurie <be...@algroup.co.uk> wrote:
>"Ralf S. Engelschall" wrote:
>> 
>> Although it still works because of the enum's actual values, mod_digest,
>> mod_speling and mod_rewrite should be updated, too. At least I find it
>> unclean to use an enum value still in a boolean context.
>
>Indeed. I designed it so that third-party modules would continue to
>work, and this applies equally to the ones I missed. They should be
>fixed, of course.

Is this right? It's not quite the same as leaving things as they are
for the digest modules.

Tony.
-- 
let it be dot at


Index: modules/experimental/mod_auth_digest.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/experimental/mod_auth_digest.c,v
retrieving revision 1.12
diff -u -r1.12 mod_auth_digest.c
--- mod_auth_digest.c	1999/12/09 05:21:00	1.12
+++ mod_auth_digest.c	2000/01/12 05:30:06
@@ -826,14 +826,14 @@
 /* Parse the Authorization header, if it exists */
 static int get_digest_rec(request_rec *r, digest_header_rec *resp)
 {
-    const char *auth_line = ap_table_get(r->headers_in,
-					 r->proxyreq ? "Proxy-Authorization"
-						     : "Authorization");
+    const char *authline;
     size_t l;
     int vk = 0, vv = 0;
     char *key, *value;
 
-
+    auth_line = ap_table_get(r->headers_in,
+			     r->proxyreq == STD_PROXY ? "Proxy-Authorization"
+						      : "Authorization");
     if (!auth_line) {
 	resp->auth_hdr_sts = NO_HEADER;
 	return !OK;
@@ -1270,7 +1270,7 @@
      * unneccessarily (it's usually > 200 bytes!).
      */
 
-    if (r->proxyreq)
+    if (r->proxyreq != NOT_PROXY)
 	domain = NULL;	/* don't send domain for proxy requests */
     else if (conf->uri_list)
 	domain = conf->uri_list;
@@ -1285,7 +1285,8 @@
     }
 
     ap_table_mergen(r->err_headers_out,
-		    r->proxyreq ? "Proxy-Authenticate" : "WWW-Authenticate",
+		    r->proxyreq == STD_PROXY ? "Proxy-Authenticate"
+					     : "WWW-Authenticate",
 		    ap_psprintf(r->pool, "Digest realm=\"%s\", nonce=\"%s\", "
 					 "algorithm=%s%s%s%s%s",
 				ap_auth_name(r), nonce, conf->algorithm,
@@ -1986,8 +1987,8 @@
 
     if (ai && ai[0])
 	ap_table_mergen(r->headers_out,
-			r->proxyreq ? "Proxy-Authentication-Info" :
-				      "Authentication-Info",
+			r->proxyreq == STD_PROXY ? "Proxy-Authentication-Info"
+						 : "Authentication-Info",
 			ai);
     return OK;
 }
Index: modules/standard/mod_digest.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_digest.c,v
retrieving revision 1.42
diff -u -r1.42 mod_digest.c
--- mod_digest.c	1999/10/21 20:45:24	1.42
+++ mod_digest.c	2000/01/12 05:30:07
@@ -136,9 +136,7 @@
 
 static int get_digest_rec(request_rec *r, digest_header_rec * response)
 {
-    const char *auth_line = ap_table_get(r->headers_in,
-                                    r->proxyreq ? "Proxy-Authorization"
-                                    : "Authorization");
+    const char *auth_line;
     int l;
     int s, vk = 0, vv = 0;
     const char *t;
@@ -154,6 +152,9 @@
 	return SERVER_ERROR;
     }
 
+    auth_line = ap_table_get(r->headers_in,
+			     r->proxyreq == STD_PROXY ? "Proxy-Authorization"
+			                              : "Authorization");
     if (!auth_line) {
 	ap_note_digest_auth_failure(r);
 	return AUTH_REQUIRED;
Index: modules/standard/mod_rewrite.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.153
diff -u -r1.153 mod_rewrite.c
--- mod_rewrite.c	1999/12/04 11:43:17	1.153
+++ mod_rewrite.c	2000/01/12 05:30:08
@@ -1123,7 +1123,7 @@
             }
 
             /* now make sure the request gets handled by the proxy handler */
-            r->proxyreq = 1;
+            r->proxyreq = STD_PROXY;
             r->handler  = "proxy-server";
 
             rewritelog(r, 1, "go-ahead with proxy request %s [OK]",
@@ -1387,7 +1387,7 @@
             }
 
             /* now make sure the request gets handled by the proxy handler */
-            r->proxyreq = 1;
+            r->proxyreq = STD_PROXY;
             r->handler  = "proxy-server";
 
             rewritelog(r, 1, "[per-dir %s] go-ahead with proxy request "
Index: modules/standard/mod_speling.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_speling.c,v
retrieving revision 1.34
diff -u -r1.34 mod_speling.c
--- mod_speling.c	1999/10/21 20:45:40	1.34
+++ mod_speling.c	2000/01/12 05:30:08
@@ -244,7 +244,7 @@
     }
 
     /* We've already got a file of some kind or another */
-    if (r->proxyreq || (r->finfo.st_mode != 0)) {
+    if (r->proxyreq != NOT_PROXY || (r->finfo.st_mode != 0)) {
         return DECLINED;
     }
 

Re: cvs commit: apache-1.3/src/modules/standard mod_mime.c

Posted by Ben Laurie <be...@algroup.co.uk>.
"Ralf S. Engelschall" wrote:
> 
> In article <20...@hyperreal.org> you wrote:
> > ben         00/01/11 06:13:50
> >
> >   Modified:    src      CHANGES
> >                src/include httpd.h
> >                src/main http_core.c http_protocol.c http_request.c
> >                src/modules/proxy mod_proxy.c mod_proxy.h proxy_ftp.c
> >                         proxy_http.c proxy_util.c
> >                src/modules/standard mod_mime.c
> >   Log:
> >   Don't convert auth to proxy auth when it shouldn't be.
> 
> Was this really reviewed and already approved for 1.3 by Jim?

It was reviewed, and approved, unless I've gone mad (entirely possible,
its been a rough day).

> I'm +1 for the change, but IMHO it's incomplete:
> 
> | :> grep proxyreq *.c
> | mod_digest.c:                                    r->proxyreq ?
> | "Proxy-Authorization"
> | mod_mime.c:         && r->proxyreq == NOT_PROXY) {
> | mod_rewrite.c:            r->proxyreq = 1;
> | mod_rewrite.c:            r->proxyreq = 1;
> | mod_speling.c:    if (r->proxyreq || (r->finfo.st_mode != 0)) {
> 
> Although it still works because of the enum's actual values, mod_digest,
> mod_speling and mod_rewrite should be updated, too. At least I find it
> unclean to use an enum value still in a boolean context.

Indeed. I designed it so that third-party modules would continue to
work, and this applies equally to the ones I missed. They should be
fixed, of course.

Cheers,

Ben.

--
SECURE HOSTING AT THE BUNKER! http://www.thebunker.net/hosting.htm

http://www.apache-ssl.org/ben.html

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi