Skip to content

Instantly share code, notes, and snippets.

@aufflick
Created April 16, 2013 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aufflick/5396650 to your computer and use it in GitHub Desktop.
Save aufflick/5396650 to your computer and use it in GitHub Desktop.
Simulate the AT&T network
use strict;
use warnings;
use HTTP::Proxy;
use HTTP::Proxy::BodyFilter::simple;
use HTTP::Proxy::BodyFilter::complete;
my $proxy = HTTP::Proxy->new( port => 8123 );
$proxy->push_filter(
mime => 'image/jpeg',
response => HTTP::Proxy::BodyFilter::complete->new,
response => HTTP::Proxy::BodyFilter::simple->new(
sub {
my ($self, $dataref, $message, $protocol, $buffer) = @_;
if (length ${$dataref} > 0)
{
${$dataref} = substr ${$dataref}, 0, (length(${$dataref}) / 2);
}
}));
$proxy->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment