Skip to content

Instantly share code, notes, and snippets.

@shentonfreude
Created March 16, 2017 19:29
Show Gist options
  • Save shentonfreude/856901d24bc4b99a795eb97c04a228c3 to your computer and use it in GitHub Desktop.
Save shentonfreude/856901d24bc4b99a795eb97c04a228c3 to your computer and use it in GitHub Desktop.
Verify we can read an HTTP Range of bytes with Perl's LWP library
#!/usr/bin/env perl
# Read a range of bytes from HTTP file
use LWP;
my $url = 'http://example.com/alex.jpg';
my $browser = LWP::UserAgent->new;
my @ns_headers = ('Range' => 'bytes=0-80');
my $response = $browser->get($url, @ns_headers);
print "Resp content:", $response->content;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment