develooper Front page | perl.poe | Postings from March 2012

Re: Fwd: poe-filter-ssl bug

From:
Markus Müller
Date:
March 9, 2012 03:13
Subject:
Re: Fwd: poe-filter-ssl bug
Message ID:
4F59E5BD.40506@priv.de
Hello Andy,

the problem is that SSL need to write back to the client if it reads 
something from the client or it has to write to the server if it reads 
something from the server. Currently there is no way in POE to do this 
in a Filter, the filter can only transform data it reads but is not able 
to write in the direction the data has been come from. POE::Filter::SSL 
in version 0.19 (still available on CPAN) don't overwrite but instead 
needs a line on the Input-Handler to be able to do the write-back. The 
Perl Module Data::Transform is a module from an other person which 
resolves the same problem in an other way than overwriting the 
problematic code on runtime. His request to support this write-back on 
reading didn't get any answer, so he realised this own module part. My 
mail on the mailing list about this issue didn't get any answer, too, so 
I made this overwriting.

Please tell me how to reproduce your problem. If I can reproduce I will 
try to fix this.

Regards,
Markus Müller
> Begin forwarded message:
>
>> From: Andy Jenkinson<andy.jenkinson@gmail.com>
>> Date: 8 March 2012 17:04:29 GMT
>> To: privi@cpan.org
>> Subject: poe-filter-ssl bug
>>
>> Hi,
>>
>> I have been having some problems adding POE::Filter::SSL into my application, which is a custom HTTP server using POE::ReadWrite and POE::Filtter::HTTPD. I have found when testing my application in Chrome that the filter would return a partially parsed request once the SSL negotiation has succeeded, bypassing the HTTPD filter. The HTTPD filter would thus be missing the beginning of the request to parse. It seems the same thing happens when using the examples in the POD itself. To cut a long story short, I have tracked the bug down to the overwriting of the Stackable get_one method. I must admit that I don't fully understand what this is doing or why the module chooses to overload Stackable's normal operation, but it looks like the problem is that the "doSendback" check takes no account of if there is data to be exchanged with the next filter, i.e. if $return is an array with multiple elements. I fixed it in my application by changing the check in the overridden get_one to:
>>
>> if (checkForDoSendback($return)&&  ($return->[0] eq $filter)) {
>>   return $return if (scalar @$return == 1);
>>   shift @$return;;
>> }
>>
>> I have to ask: why does the filter need to go through this hacking of the symbol table?
>>
>> Cheers,
>> Andy





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About