You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Stein <gs...@lyra.org> on 1999/02/25 02:38:57 UTC

[PATCH] Re: ugly problem with sub-requests

Ben Laurie wrote:
> Greg Stein wrote:
> > I'm not sure that I'd recommend simply changing
> > ap_set_sub_req_protocol() to simply copying over the method. The
> > semantics of the sub-request might actually be "do a GET request". I
> > would probably request a function just like ap_sub_req_lookup_uri(), but
> > where I can pass a method. It would set the method and method_number
> > from the argument, but otherwise behave the same.
> 
> I'm probably stating the bleedin' obvious here, but its never stopped me
> before... do this, and rewrite ap_sub_req_lookup_uri in terms of it,
> passing "GET" as the method.

Done :-)  ... attached.

It gets rid of my icky hack quite nicely!

Cheers,
-g

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

Re: [PATCH] Re: ugly problem with sub-requests

Posted by Dean Gaudet <dg...@arctic.org>.

On Thu, 25 Feb 1999, Dean Gaudet wrote:

> (I wonder how much noise -Wwrite-strings gives these days...) 

(lots, and it also depends on how nice your libc header files are...)

Dean


Re: [PATCH] Re: ugly problem with sub-requests

Posted by Dean Gaudet <dg...@arctic.org>.

On Thu, 25 Feb 1999, Greg Stein wrote:

> > +     /* ### would be nice to pass "method" to ap_set_sub_rqe_protocol */
> > +     rnew->method = method;
> > +     rnew->method_number = ap_method_number_of(method);
> > +
> 
> Right here.  rnew->method is "char *", while the argument is "const char
> *". The compiler complains about dropping the "const".
> 
> I'm not sure whether to argue for a change to the request_rec structure,
> or to bite down and do an ap_pstrdup().

Change it to const char *method in the request_rec ... there's at least
one place where it's set to a ""-quoted string, so anyone mucking with it
is potentially doing harm.

(I wonder how much noise -Wwrite-strings gives these days...) 

Dean



Re: [PATCH] Re: ugly problem with sub-requests

Posted by Greg Stein <gs...@lyra.org>.
Greg Stein wrote:
>...
> Done :-)  ... attached.
> 
> It gets rid of my icky hack quite nicely!

Oop. One tweakiness is in here:

> ...
> diff -c -r ./src/main/http_request.c ../../apache_1.3.4/src/main/http_request.c
> ...
> ! API_EXPORT(request_rec *) ap_sub_req_method_uri(const char *method,
> !                                               const char *new_file,
> !                                               const request_rec *r)
>   {
>       request_rec *rnew;
>       int res;
> ***************
> *** 736,741 ****
> --- 737,746 ----
> 
>       ap_set_sub_req_protocol(rnew, r);
> 
> +     /* ### would be nice to pass "method" to ap_set_sub_rqe_protocol */
> +     rnew->method = method;
> +     rnew->method_number = ap_method_number_of(method);
> +

Right here.  rnew->method is "char *", while the argument is "const char
*". The compiler complains about dropping the "const".

I'm not sure whether to argue for a change to the request_rec structure,
or to bite down and do an ap_pstrdup().

??

thx
-g

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

Re: [PATCH] Re: ugly problem with sub-requests

Posted by Doug MacEachern <do...@pobox.com>.
>Done :-)  ... attached.
>
>It gets rid of my icky hack quite nicely!

very nice, +1

-Doug