Bug 43550 - mod_negotiation is not passing query strings and path info when using typemaps
Summary: mod_negotiation is not passing query strings and path info when using typemaps
Status: RESOLVED DUPLICATE of bug 33112
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_negotiation (show other bugs)
Version: 2.2.6
Hardware: All Linux
: P2 regression (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2007-10-04 06:52 UTC by Jose Kahan
Modified: 2010-02-23 20:07 UTC (History)
0 users



Attachments
Patch against 2.2.6 (913 bytes, patch)
2007-10-04 06:56 UTC, Jose Kahan
Details | Diff
Patch against trunk (1.00 KB, patch)
2007-10-04 06:56 UTC, Jose Kahan
Details | Diff
New test procedure for perl-framework for testing typemaps and query string parameters (1.54 KB, application/octet-stream)
2007-10-04 07:02 UTC, Jose Kahan
Details
Query string were not being handled to resources handled by typemaps (2.2.6 patch) (910 bytes, patch)
2007-10-11 14:19 UTC, Jose Kahan
Details | Diff
Query string were not being handled to resources handled by typemaps (trunk patch) (1021 bytes, patch)
2007-10-11 14:21 UTC, Jose Kahan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jose Kahan 2007-10-04 06:52:59 UTC
Query strings are not being passed along when mod_negotiation
combines  multiviews with typemap processing. This is a regression
compared to the behavior we had on Apache 1.3.x. It is complementary
to PR 33112, which fixed a similar problem, but in a different part
of the same module.

The guilty party is the call to

   ap_internal_fast_redirect(sub_req, r)

in mod_negotiation.c:handle_multi() which discards the
previously parsed args and path_info. That info is
not regenerated again. I'm including a very naive patch
against 2.2.6 and trunk that fixes this.  I'm sure there is a
better way to fix it, but need more guidance
to achieve it in an optimal way.

I'm also submitting a new test for the perl-framework test procedure
that tests this behavior, to avoid having this regression in next 
versions.

== Reproducing the bug ==

You can use either use the new test I'm submitting or use the following 
scenario. Please adjust accordingly
to your server setup. I assume the use of php
for printing out the query parameters; you could use
perl (like my test procedure contribution does) or a shell script too):

1. In a directory, put the three files that I've attached:
   test.html, test.php, test.var

2. query the server for test.php?q=3

           http://localhost/test.php?q=3

    ==> you'll see that the query parameters are correctly
        passed to the script.

3. query the server for test?q=3

           http://localhost/test?q=3

    ==> in this case, the query parameters have been discarded
        by mod_negotiation's call to
        ap_internal_fast_redirect inside handle_multi().

You'll see that my naive solution is to make a backup copy of
args and path_info, if they existed, before the call to
ap_internal_fast_redirect(), and then restoring them. This
effectively solves the bug. I don't know if there's a better
way to do this.
Comment 1 Jose Kahan 2007-10-04 06:56:05 UTC
Created attachment 20915 [details]
Patch against 2.2.6

Typemap handling didn't pass the query string and path_info parameters
Comment 2 Jose Kahan 2007-10-04 06:56:45 UTC
Created attachment 20916 [details]
Patch against trunk

Typemap handling didn't pass the query string and path_info parameters.
Comment 3 Jose Kahan 2007-10-04 07:02:25 UTC
Created attachment 20917 [details]
New test procedure for perl-framework for testing typemaps and query string parameters 

DESCRIPTION

The following tests checks that query string parameters are being
correctly passed-on whenever a resource is selected by means
of a type-map.

CONTENT

This test has been prepared using the svn trunk version of httpd-test
and is comprised of:

1. Test htdocs directory:

  httpd-test/perl-framework/t/htdocs/modules/negotiation/ \
    typemap_query_string
      |
      - test.html
      |
      - test.pl
      |
      - test.var

2. Patches to both t/conf/extra.conf.in and t/modules/negotiation.t
   to include the new test

    typemaptest.diff

INSTALLATION

1. Check out the httpd-test directory
    svn checkout http://svn.apache.org/repos/asf/httpd/test/trunk/ \
     httpd-test

2. Install the
    htdocs/modules/negotiation/typemap_query_string/ directory
    and files.

     tar -xzf typemapqstest.tgz

3. Patch extra.conf.in and negotiation.t to include the new test

   patch -p0 <typemaptest.diff

DESCRIPTION OF THE TEST

The test consists in requesting the following resource:

    http://server/..../typemap_query_string/test?foo

If the query string parameter is being passed correctly, test.pl will
be called and will return the string
    QUERY_STRING --> foo

RUNNING THE TEST

    t/TEST modules/negotiation

The new test has number #99.

Note that this test will fail unless you apply the patch to
mod_negotiation which is included in my report.
Comment 4 Jose Kahan 2007-10-11 14:19:27 UTC
Created attachment 20962 [details]
Query string  were not being handled to resources handled by typemaps (2.2.6 patch)

When preparing my patch for submission, I a typo which caused a sigsev. Here's
the correct patch.
Comment 5 Jose Kahan 2007-10-11 14:21:58 UTC
Created attachment 20963 [details]
Query string  were not being handled to resources handled by typemaps (trunk patch)

When preparing my patch for submission, I a typo which caused a sigsev.
Here's the correct patch.
Comment 6 Joe Orton 2007-10-29 08:06:57 UTC
Test case added in http://svn.apache.org/viewvc?view=rev&revision=589666 - thanks!
Comment 7 Ruediger Pluem 2010-02-23 20:07:24 UTC
This seems now fixed by fixing PR33112

*** This bug has been marked as a duplicate of bug 33112 ***