On Tue, Aug 14, 2001 at 07:25:32PM -0700, David Rees wrote:
> On Tue, Aug 14, 2001 at 10:20:26PM -0400, Keith Wannamaker wrote:
> >
> > Unfortunately there are people who were breaking because
> > we didn't follow the spec.  The better way to fix it is
> > to create an inverse function for 
> > ap_parse_uri(request_rec *r, const char *uri) [http_protocol.c]
> > in mod_jk... one that would 'unparse' the munged
> > r->uri rewrite and use it instead of r->unparsed_uri.
> 
> Hi,
> 
> OK, are you volunteering to write it?  ;-)  If not, I'll have to take a look
> when I get some time and see if I can figure it out.
> 
> As an aside, it appears that Tomcat 3.3 remains broken in this regard, as it
> uses r->uri instead of r->unparsed_uri.

My bad.  It is actually easier than I just said - s->req_uri isn't
the complete unparsed URI - just the path.

I didn't look high enough in mod_jk.c.  The version in j-t-c for 
apache-1.3 has:

    s->query_string = r->args;

    /*
     * The 2.2 servlet spec errata says the uri from
     * HttpServletRequest.getRequestURI() should remain encoded.
     * [http://java.sun.com/products/servlet/errata_042700.html]
     */
    s->req_uri      = r->unparsed_uri;
    if (s->req_uri != NULL) {
        char *query_str = strchr(s->req_uri, '?');
        if (query_str != NULL) {
            *query_str = 0;
        }
    }

That strchr call is trying to remove the query string (dicking with
the unparsed_uri like that is a BAD idea - imagine logs looking at the
unparsed_uri).  

You could just have:

    s->query_string = r->args;
    /*
     * The 2.2 servlet spec errata says the uri from
     * HttpServletRequest.getRequestURI() should remain encoded.
     * [http://java.sun.com/products/servlet/errata_042700.html]
     */
    s->req_uri      = ap_encode_uri(r->pool, r->uri);

That seems like it'd satisfy everyone.  -- justin

Reply via email to