summaryrefslogtreecommitdiff
path: root/lib/LWP/Protocol/loopback.pm
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-02-14 18:44:00 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-02-14 18:44:00 +0000
commit20f161ca116b8a4fc7ac986a317d7f6d43e5c173 (patch)
treee61bb7f98a2c80dd9264c5f3810c4765419e64b7 /lib/LWP/Protocol/loopback.pm
downloadlibwww-perl-tarball-master.tar.gz
Diffstat (limited to 'lib/LWP/Protocol/loopback.pm')
-rw-r--r--lib/LWP/Protocol/loopback.pm26
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;