in reply to LWP Slow Get

What's wrong with going through $content one character at a time with a loop and substr or something? Why do you need to download it from the server slowly one character at a time?

Replies are listed 'Best First'.
Re^2: LWP Slow Get
by Fletch (Bishop) on Apr 03, 2007 at 19:01 UTC

    That's on the wrong end, if I understand the remark about IDS penetration testing. He wants to send the HTTP GET request slowly over a long time to see if the remote side notices the suspicious request or not (although I'd think that any sane IDS would be reconstructing things on the TCP connection level and looking at the stream as a whole regardless of how long it takes (of course that ups the resource requirements in that you've got to maintain that context until it is a complete request, or complete enough to tell if it's hostile or not) in order to avoid this sort of weakness; but then maybe that's what they're trying to ascertain).

      You're right on, Fletch. Check this out. It appears to work, but I have to take a quick capture to verify:
      #!/usr/bin/perl -w use IO::Socket; unless (@ARGV > 1) { die "usage: $0 host document ..." } $host = shift(@ARGV); $get = "GET / HTTP/1.0\n\n"; $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $host, PeerPort => "http(80)", ); unless ($remote) { die "cannot connect to http daemon on $host" } $remote->autoflush(1); @lines = split(//,$get); foreach $singlechar (@lines) { print $remote $singlechar; sleep(1); #while ( <$remote> ) { print } } close $remote;