diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-02-14 18:44:00 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-02-14 18:44:00 +0000 |
commit | 20f161ca116b8a4fc7ac986a317d7f6d43e5c173 (patch) | |
tree | e61bb7f98a2c80dd9264c5f3810c4765419e64b7 /lib/LWP/Protocol/loopback.pm | |
download | libwww-perl-tarball-master.tar.gz |
libwww-perl-6.13HEADlibwww-perl-6.13master
Diffstat (limited to 'lib/LWP/Protocol/loopback.pm')
-rw-r--r-- | lib/LWP/Protocol/loopback.pm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/LWP/Protocol/loopback.pm b/lib/LWP/Protocol/loopback.pm new file mode 100644 index 0000000..2cd67ae --- /dev/null +++ b/lib/LWP/Protocol/loopback.pm @@ -0,0 +1,26 @@ +package LWP::Protocol::loopback; + +use strict; +use vars qw(@ISA); +require HTTP::Response; + +require LWP::Protocol; +@ISA = qw(LWP::Protocol); + +sub request { + my($self, $request, $proxy, $arg, $size, $timeout) = @_; + + my $response = HTTP::Response->new(200, "OK"); + $response->content_type("message/http; msgtype=request"); + + $response->header("Via", "loopback/1.0 $proxy") + if $proxy; + + $response->header("X-Arg", $arg); + $response->header("X-Read-Size", $size); + $response->header("X-Timeout", $timeout); + + return $self->collect_once($arg, $response, $request->as_string); +} + +1; |