Loading ...
Sorry, an error occurred while loading the content.
 

Re: bug with mod_perl and CGI.pm

Expand Messages
  • Lincoln Stein
    Hi Lan, Do you think this might be a bug in mod_perl 1.99X? It is the responsibility of mod_perl s CGI compatibility mode to set the CGI environment
    Message 1 of 4 , Apr 30, 2004
      Hi Lan,

      Do you think this might be a bug in mod_perl 1.99X? It is the
      responsibility of mod_perl's CGI compatibility mode to set the CGI
      environment variables. It doesn't look as though CGI.pm ever tries
      to set CONTENT_LENGTH itself, even when running under mod_perl, but
      relies on mod_perl to do this. I'm not trying to evade
      responsibility here, but just to understand where this bug report
      should be directed.

      Best,

      Lincoln

      On Wednesday 28 April 2004 10:01 am, Lan Yufeng wrote:
      > Hi, father of CGI.pm :)
      > I found a problem when using CGI.pm to parse POSTed data passed to
      > mod_perl handler: The %ENV{Content-Length} will never get changed,
      > which make CGI $query object method param() returned incorrect hash
      > data after the 1st post request.
      > Here is the script to test:
      > -- t/post.t ---->
      >
      > use Apache::Test;use Apache::TestUtil;use Apache::TestRequest
      > 'POST'; # First post request
      > my $location='/test/post'
      > my $resp = POST $location, Content=>[ name=>'foo',
      > title=>'bar',]; # following requests go on.
      > my $resp = POST $location Content=>[ some=>'a long string
      > exceeds the content-length of the last request', string=>'another
      > string you wont see',];
      > chomp(my $re = $resp->content);
      > ok t_cmp("expected value",$re,"A bug with mod_perl and
      > CGI.pm");
      >
      > --- end ----
      > -- codes in a mod_perl reponse handler Apache::Post-->
      >
      > my $q = new CGI($r);
      > $r->print($q->Dump);
      > return Apache::OK;
      >
      > --- end ----
      > --- part of httpd.conf ---
      >
      > <Location /test/post>
      > SetHandler modperl
      > PerlResponseHandler Apache::Post
      > </Location>
      >
      > --- end ----
      > run script with: "t/TEST t/post.t -verbose"
      > And you will found that only part of the second POST request data
      > is dumped by $q->Dump
      >
      > * the version of CGI.pm (perl -MCGI -le 'print $CGI::VERSION'):
      > 3.05 * the version of Perl (perl -v): v5.8.0
      > * the name and version of your Web server: Apache 2.0.44 with
      > mod_perl 1.99-05
      > * the name and version of the operating system you are using:
      > Redhat 8.0
      > * if applicable, the name and version of the browser you are
      > using: perl LWP module
      > * a short test script that reproduces the problem (30 lines or
      > less): as above.
      >
      > I just want to use CGI.pm to parse POSTed data from clients in this
      > case until I found this problem. I think every time I call "new
      > CGI($apache_request_object)", the %ENV{Content-length} needed to
      > read data in CGI.pm doesn't get refreshed.
      >
      > BTW, I can use built-in API "$r->read()" in mod_perl to read
      > compelete posted body data and headers.
      >
      > sincerely yours,

      --
      Lincoln D. Stein
      Cold Spring Harbor Laboratory
      1 Bungtown Road
      Cold Spring Harbor, NY 11724

      --
      Report problems: http://perl.apache.org/bugs/
      Mail list info: http://perl.apache.org/maillist/modperl.html
      List etiquette: http://perl.apache.org/maillist/email-etiquette.html
    • Stas Bekman
      ... Lincoln, If anybody reports to you a problem with a mp2 which is as old 1.99_05 (2 years old) as them to update to the latest current version. CGI.pm works
      Message 2 of 4 , May 1, 2004
        Lincoln Stein wrote:
        > Hi Lan,
        >
        > Do you think this might be a bug in mod_perl 1.99X? It is the
        > responsibility of mod_perl's CGI compatibility mode to set the CGI
        > environment variables. It doesn't look as though CGI.pm ever tries
        > to set CONTENT_LENGTH itself, even when running under mod_perl, but
        > relies on mod_perl to do this. I'm not trying to evade
        > responsibility here, but just to understand where this bug report
        > should be directed.

        Lincoln,

        If anybody reports to you a problem with a mp2 which is as old 1.99_05 (2
        years old) as them to update to the latest current version. CGI.pm works just
        fine with it. You may even consider to change CGI.pm to refuse to run unless
        they have let's say at least 1.99_12 and keep on moving the target till 2.0 is
        released, to save yourself and the user time. Thanks!

        Lan, please update to mod_perl 1.99_13 which is the latest version and try
        again. If still in trouble, please post the bugreport to this list. Thanks.

        > On Wednesday 28 April 2004 10:01 am, Lan Yufeng wrote:
        [...]
        >> * the name and version of your Web server: Apache 2.0.44 with
        >>mod_perl 1.99-05

        __________________________________________________________________
        Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
        http://stason.org/ mod_perl Guide ---> http://perl.apache.org
        mailto:stas@... http://use.perl.org http://apacheweek.com
        http://modperlbook.org http://apache.org http://ticketmaster.com

        --
        Report problems: http://perl.apache.org/bugs/
        Mail list info: http://perl.apache.org/maillist/modperl.html
        List etiquette: http://perl.apache.org/maillist/email-etiquette.html
      • Lincoln Stein
        Hi Stas, Thanks for the advice. By the way, I m currently moving all my mod_perl 1.X modules to 2.X, using the Apache::MP3 port you did a year ago as my
        Message 3 of 4 , May 1, 2004
          Hi Stas,

          Thanks for the advice. By the way, I'm currently moving all my mod_perl 1.X
          modules to 2.X, using the Apache::MP3 port you did a year ago as my guide.
          Thanks for the help!

          Lincoln

          On Saturday 01 May 2004 01:12 pm, Stas Bekman wrote:
          > Lincoln Stein wrote:
          > > Hi Lan,
          > >
          > > Do you think this might be a bug in mod_perl 1.99X? It is the
          > > responsibility of mod_perl's CGI compatibility mode to set the CGI
          > > environment variables. It doesn't look as though CGI.pm ever tries
          > > to set CONTENT_LENGTH itself, even when running under mod_perl, but
          > > relies on mod_perl to do this. I'm not trying to evade
          > > responsibility here, but just to understand where this bug report
          > > should be directed.
          >
          > Lincoln,
          >
          > If anybody reports to you a problem with a mp2 which is as old 1.99_05 (2
          > years old) as them to update to the latest current version. CGI.pm works
          > just fine with it. You may even consider to change CGI.pm to refuse to run
          > unless they have let's say at least 1.99_12 and keep on moving the target
          > till 2.0 is released, to save yourself and the user time. Thanks!
          >
          > Lan, please update to mod_perl 1.99_13 which is the latest version and try
          > again. If still in trouble, please post the bugreport to this list. Thanks.
          >
          > > On Wednesday 28 April 2004 10:01 am, Lan Yufeng wrote:
          >
          > [...]
          >
          > >> * the name and version of your Web server: Apache 2.0.44 with
          > >>mod_perl 1.99-05
          >
          > __________________________________________________________________
          > Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
          > http://stason.org/ mod_perl Guide ---> http://perl.apache.org
          > mailto:stas@... http://use.perl.org http://apacheweek.com
          > http://modperlbook.org http://apache.org http://ticketmaster.com

          --
          Lincoln Stein
          lstein@...
          Cold Spring Harbor Laboratory
          1 Bungtown Road
          Cold Spring Harbor, NY 11724
          (516) 367-8380 (voice)
          (516) 367-8389 (fax)

          --
          Report problems: http://perl.apache.org/bugs/
          Mail list info: http://perl.apache.org/maillist/modperl.html
          List etiquette: http://perl.apache.org/maillist/email-etiquette.html
        • Stas Bekman
          ... You re welcome, Lincoln :) BTW, the whole process is documented here:
          Message 4 of 4 , May 1, 2004
            Lincoln Stein wrote:
            > Hi Stas,
            >
            > Thanks for the advice. By the way, I'm currently moving all my mod_perl 1.X
            > modules to 2.X, using the Apache::MP3 port you did a year ago as my guide.
            > Thanks for the help!

            You're welcome, Lincoln :)

            BTW, the whole process is documented here:
            http://perl.apache.org/docs/2.0/user/porting/porting.html#How_C_Apache__MP3__was_Ported_to_mod_perl_2_0

            Does it mean that you will get Apache::MP3 ported as well? I've never had a
            chance to re-merge my changes into your newer version.

            __________________________________________________________________
            Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
            http://stason.org/ mod_perl Guide ---> http://perl.apache.org
            mailto:stas@... http://use.perl.org http://apacheweek.com
            http://modperlbook.org http://apache.org http://ticketmaster.com

            --
            Report problems: http://perl.apache.org/bugs/
            Mail list info: http://perl.apache.org/maillist/modperl.html
            List etiquette: http://perl.apache.org/maillist/email-etiquette.html
          Your message has been successfully submitted and would be delivered to recipients shortly.