in reply to Re: ICAP server implementation in Perl
in thread ICAP server implementation in Perl

Looks like HTTP::Proxy and/or Plack could be leveraged for icap

If HTTP::Response/HTTP::Request can parse these ical req/res then so can Proxy and Plack... probably even Mojolicious

#!/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 );
  • Comment on Re^2: ICAP server implementation in Perl (HTTP::Request .. HTTP::Proxy)
  • Download Code

Replies are listed 'Best First'.
Re^3: ICAP server implementation in Perl (HTTP::Request .. HTTP::Proxy)
by josef (Acolyte) on Oct 24, 2013 at 15:29 UTC
    Thanks for response. I'll think about a solution.

    Have a nice day, Josef