httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apache-1.3/src/main http_request.c
Date Sat, 05 Aug 2000 03:57:29 GMT
It was a "char *" for years, until r->method was changed to const in March
1999. I can't see how it would matter whether it was from a pool or not
since it is labelled as const.

In any case... are you saying that we should continuing dup'ing the "GET" ?

Cheers,
-g

On Fri, Aug 04, 2000 at 04:14:33PM -0700, Rasmus Lerdorf wrote:
> Unless of course somewhere else in the code we expect this to be a piece
> of memory allocated from a pool and we don't want to keep track of whether
> it is or not.  I took a quick look and didn't actually see that this was
> the case, but this code has been like this for years, literally...
> 
> -Rasmus
> 
> > r->method is a "const char *". There is no reason to strdup a constant
> > string in the first place.
> > 
> > Cheers,
> > -g
> > 
> > On Fri, Aug 04, 2000 at 06:59:05PM -0000, rasmus@locus.apache.org wrote:
> > > rasmus      00/08/04 11:59:05
> > > 
> > >   Modified:    src/main http_request.c
> > >   Log:
> > >   Prevent a HEAD request from being converted to a GET request on an
> > >   ErrorDocument redirect.  Also save a couple of cycles by not duping
> > >   a "GET" on top of a "GET" so the people who benchmark thousands of
> > >   ErrorDocument redirects should see a slight improvement now... ;)
> > >   
> > >   Revision  Changes    Path
> > >   1.154     +8 -2      apache-1.3/src/main/http_request.c
> > >   
> > >   Index: http_request.c
> > >   ===================================================================
> > >   RCS file: /home/cvs/apache-1.3/src/main/http_request.c,v
> > >   retrieving revision 1.153
> > >   retrieving revision 1.154
> > >   diff -u -r1.153 -r1.154
> > >   --- http_request.c	2000/03/20 16:50:15	1.153
> > >   +++ http_request.c	2000/08/04 18:59:04	1.154
> > >   @@ -1035,8 +1035,14 @@
> > >                if ((error_notes = ap_table_get(r->notes, "error-notes"))
!= NULL) {
> > >    		ap_table_setn(r->subprocess_env, "ERROR_NOTES", error_notes);
> > >    	    }
> > >   -            r->method = ap_pstrdup(r->pool, "GET");
> > >   -            r->method_number = M_GET;
> > >   +	    /* 
> > >   +	     * If it is already a GET or a HEAD, don't change it 
> > >   +	     * (method_number for GET and HEAD is the same) 
> > >   +	     */
> > >   +	    if(r->method_number!=M_GET) { 
> > >   +            	r->method = ap_pstrdup(r->pool, "GET");
> > >   +            	r->method_number = M_GET;
> > >   +	    }
> > >                ap_internal_redirect(custom_response, r);
> > >                return;
> > >            }
> > >   
> > >   
> > >   
> > 
> > 

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message