[PATCH] Apache2::RequestIO::read bugfix + enhancements

View: New views
3 Messages — Rating Filter:   Alert me  

[PATCH] Apache2::RequestIO::read bugfix + enhancements

by Torsten Foertsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

it began with an innocent cycle to read the request body:

    1 while( do{my $l=$r->read($content, 8000, $where); $where+=$l; $l} );

Surprisingly $content was an empty string while $where said that some data was
read. I found that Apache2::RequestIO::read resets the passed buffer when end
of file is read that means if modperl_request_read() returns 0.

Then I thought to remove these 2 XXX lines. And then what would happen in
these situations:

$content=123456;
$r->read($content, 100, 3);

or

"....."=~/(.*)/;
$r->read($1, 100);

Please review.

Torsten

[attachment removed]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...

Re: [PATCH] Apache2::RequestIO::read bugfix + enhancements

by Philip M. Gollucci :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Torsten Foertsch wrote:
> Please review.
+        /* use the same error message as perl core's read() */
+        Perl_croak(aTHX_ "Negative length");
It possible someone is regexing $@ against the previous string. Do you
really need to change the message ?


+    /* modperl_request_read can return only >=0. So it's save to do
this. */
+    /* if total==0 we need to set the buffer length in case it is larger */


s/save/safe/


By any chance have you tried mod_apreq2 perl glue on top of this patch ?

+1


--
------------------------------------------------------------------------
Philip M. Gollucci (philip@...)
o:703.549.2050x206
Senior System Admin - Riderway, Inc.
http://riderway.com / http://ridecharge.com
1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70  3F8C 75B8 8FFB DB9B 8C1C

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: [PATCH] Apache2::RequestIO::read bugfix + enhancements

by Torsten Foertsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri 18 Jul 2008, Philip M. Gollucci wrote:
> Torsten Foertsch wrote:
> > Please review.
>
> +        /* use the same error message as perl core's read() */
> +        Perl_croak(aTHX_ "Negative length");
> It possible someone is regexing $@ against the previous string. Do
> you really need to change the message ?

I doubt it but of course not.

> +    /* modperl_request_read can return only >=0. So it's save to do
> this. */
> +    /* if total==0 we need to set the buffer length in case it is
> larger */
>
>
> s/save/safe/

thanks

> By any chance have you tried mod_apreq2 perl glue on top of this
> patch ?

Current SVN passed all tests. So, I committed that stuff.

Torsten

--
Need professional mod_perl support?
Just hire me: torsten.foertsch@...

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...