Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/resources/load-and-stall.cgi

Issue 2645953004: Update duration when demuxed packets exceed known duration. (Closed)
Patch Set: Remove broken CGI server. Rate limit duration changed events. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/perl -wT
2
3 use CGI;
4 use File::stat;
5 use Time::HiRes;
6
7 $query = new CGI;
8 $name = $query->param('name');
9 $stallAt = $query->param('stallAt');
10 $stallFor = $query->param('stallFor');
11 $mimeType = $query->param('mimeType');
12
13 my $filesize = stat($name)->size;
14 print "Content-type: " . $mimeType . "\n";
15 print "Content-Length: " . $filesize . "\n\n";
16
17 open FILE, $name or die;
18 binmode FILE;
19 $total = 0;
20 my ($buf, $data, $n);
21 while (($n = read FILE, $data, 1024) != 0) {
22 $total += $n;
23 if ($total > $stallAt) {
24 if (defined $stallFor) {
25 Time::HiRes::sleep($stallFor)
26 }
27 last;
28 }
29 print $data;
30 }
31 close(FILE);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698