#!/usr/bin/perl --
use strict;
use warnings;
use HTTP::Response;
use HTTP::Request;
use Data::Dump qw/ dd pp /;
my $req_raw = q{REQMOD icap://icap-server.net/server?arg=87 ICAP/1.0
Host: icap-server.net
Encapsulated: req-hdr=0, null-body=170
GET / HTTP/1.1
Host: www.origin-server.com
Accept: text/html, text/plain
Accept-Encoding: compress
Cookie: ff39fk3jur@4ii0e02i
If-None-Match: "xyzzy", "r2d2xxxx"
};
my $res_raw = q{ICAP/1.0 200 OK
Date: Mon, 10 Jan 2000 09:55:21 GMT
Server: ICAP-Server-Software/1.0
Connection: close
ISTag: "W3E4R7U9-L2E4-2"
Encapsulated: req-hdr=0, null-body=231
GET /modified-path HTTP/1.1
Host: www.origin-server.com
Via: 1.0 icap-server.net (ICAP Example ReqMod Service 1.1)
Accept: text/html, text/plain, image/gif
Accept-Encoding: gzip, compress
If-None-Match: "xyzzy", "r2d2xxxx"
};
my $req = HTTP::Request->parse($req_raw);
my $res = HTTP::Response->parse($res_raw);
dd( $res, $req );
dd( "req_raw eq req->as_string " => int( $req_raw eq $req->as_string )
+ );
dd( "res_raw eq res->as_string " => int( $res_raw eq $res->as_string )
+ );
print "-" x 33, "\n", $req->dump;
print "-" x 33, "\n", $res->dump;
dd( $req_raw, $req->as_string );
dd( $res_raw, $res->as_string );
|