HTTP::Proxy in Perl -
i need show "content" in hash , test : $c->header("content") , but shows nothing , in content hash value if this.
as can show _content?
the hash
<pre> $var1 = bless( { '_protocol' => 'http/1.1', '_content' => '-----------------------------8283483225031 content-disposition: form-data; name="archivo"; filename="gfwlivesetuplog.txt" content-type: text/plain l v e r e d s t : 0 g f w l c l e n t : 0 -----------------------------8283483225031 content-disposition: form-data; name="destino" c:/perl/test.txt -----------------------------8283483225031-- ', '_uri' => bless( { \( $o = 'http://localhost/shell.php?uploa d=' ); }, 'uri::http' ), '_headers' => bless( { 'user-agent' => 'mozilla/5.0 (windows nt 5.1; rv:19.0) gecko/20100101 firefox/19.0', 'accept' => 'text/html,application/xhtml +xml,application/xml;q=0.9,*/*;q=0.8', 'accept-language' => 'es-ar,es;q=0.8,en- us;q=0.5,en;q=0.3', 'cookie' => 'phpsessid=a8bkktvsripf6agpi fnma61qq4', 'content-length' => '378', 'host' => 'localhost', 'via' => '1.1 doddy-701c8cb49 (http::pro xy/0.20)', 'content-type' => 'multipart/form-data; boundary=---------------------------8283483225031', 'x-forwarded-for' => '127.0.0.1', 'referer' => 'http://localhost/shell.php ?upload=' }, 'http::headers' ), '_method' => 'post' }, 'http::request' ); </pre> the source :
use http::proxy; use http::proxy::bodyfilter::simple; use http::proxy::bodyfilter::complete; use data::dumper; $server = http::proxy->new(port=>8080); $server->host(); $server->push_filter(mime=>undef,response => http::proxy::bodyfilter::complete->new()); $server->push_filter( mime=>undef, request=>http::proxy::bodyfilter::simple->new(\&enable), response => http::proxy::bodyfilter::simple->new(\&enable2)); $server->start(); sub enable { my($a,$b,$c,$d,$e) = @_; print $c->header("content"); #print dumper $c; } sub enable2 { ($j,$k,$l,$m,$n) = @_; print $$k; } pd : excuse bad english
the content not in headers. in dumper output, headers http::headers object denoted _headers key. want call content method.
$c->content; see http::request documentation full list of available methods.
Comments
Post a Comment