Hi Folks,

This is some code I wrote for testing "aggregated" or "bonded" ethernet
connections.  It provides two methods, "split" and "join", for chopping up
HTTP::Request objects and gluing HTTP::Response objects together.

The namespace was chosen because this module uses the HTTP "Range" and
"Content-Range" headers.

I believe that others may find this module useful but I'd like to receive
comments before uploading it to CPAN.

Available immediately from:
                                                                                       
                                                         
http://kolea.ifa.hawaii.edu/~jhoblitt/pm/HTTP-Range-0.01.tar.gz

Cheers,
                                                                                       
                                                         
-J
                                                                                       
                                                         
--
NAME
       HTTP::Range - Handle multi-segment HTTP requests
                                                                                       
                                                         
SYNOPSIS
           require HTTP::Range;
           require HTTP::Request;
           require LWP::UserAgent;
           require LWP::Parallel::UserAgent;
 
           my $url = "http://example.com";;
           my $segments = 2;
 
           my $head_request = HTTP::Request->new( HEAD => $url );
           my $head_response = LWP::UserAgent->new->request( $head_request );
           my $get_request = HTTP::Request->new( GET => $head_request->uri );
 
           # divide a single HTTP request object into many
           my @requests = HTTP::Range->split(
                   request     => $get_request,
                   length      => $head_response->header( 'Content-Length' ),
                   segments    => $segments,
               );
 
           my $pua = LWP::Parallel::UserAgent->new;
           $pua->register( $_ ) foreach @requests;
           my $entries = $pua->wait;
           my @responses;
           push( @responses, $entries->{ $_ }->response ) foreach keys %$entries;
 
           # fuse many HTTP responses into a single object
           my $res = HTTP::Range->join(
                   responses   => [EMAIL PROTECTED],
                   length      => $head_response->header( 'Content-Length' ),
                   segments    => $segments,
               );
 
           print $res->as_string;
 
DESCRIPTION
       This module provides class methods that allow you to divide an
       HTTP::Request object into multiple smaller segments of the original
       request and to fuse the HTTP::Response objects resulting from a seg-
       mented transfer back into a complete resource.  The segmentation is
       accomplished via the use of the HTTP "Range" and "Content-Range" fields
       as defined in "RFC2616".
                                                                                
       This module aims to be useful for HTTP transfers across aggregated net-
       work connections, as is possible for Ethernet with "IEEE 802.3ad".  It
       may also be advantageous on high latency network links where a single
       TCP session won't scale to use all available bandwidth and it will
       probably circumvent some HTTP bandwidth throttling techniques.

Reply via email to