ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Coro/myhttpd/httpd.pl
(Generate patch)

Comparing cvsroot/Coro/myhttpd/httpd.pl (file contents):
Revision 1.65 by root, Fri Jan 25 09:26:13 2002 UTC vs.
Revision 1.91 by root, Thu Feb 4 22:35:47 2010 UTC

1use Coro; 1use Coro;
2use Coro::Semaphore; 2use Coro::Semaphore;
3use Coro::SemaphoreSet;
3use Coro::Event; 4use Coro::EV;
4use Coro::Socket; 5use Coro::Socket;
5use Coro::Signal; 6use Coro::Signal;
7use Coro::AIO ();
6 8
9use Fcntl;
7use HTTP::Date; 10use HTTP::Date;
8use POSIX (); 11use POSIX ();
9 12
10use Compress::Zlib (); 13use Compress::Zlib ();
11 14
12no utf8; 15use common::sense;
13use bytes;
14 16
15# at least on my machine, this thingy serves files 17# at least on my machine, this thingy serves files
16# quite a bit faster than apache, ;) 18# quite a bit faster than apache, ;)
17# and quite a bit slower than thttpd :( 19# and quite a bit slower than thttpd :(
18 20
19$SIG{PIPE} = 'IGNORE'; 21$SIG{PIPE} = 'IGNORE';
20 22
21our $accesslog; 23our $accesslog;
22our $errorlog; 24our $errorlog;
25our @listen_sockets;
23 26
24our $NOW; 27our $NOW;
25our $HTTP_NOW; 28our $HTTP_NOW;
26 29
27Event->timer(interval => 1, hard => 1, cb => sub { 30our $ERROR_LOG;
31our $ACCESS_LOG;
32our $TRANSFER_LOCK = new Coro::SemaphoreSet; # lock to be acquired per ip
33
34our $update_time = EV::periodic 0, 1, undef, sub {
28 $NOW = time; 35 $NOW = time;
29 $HTTP_NOW = time2str $NOW; 36 $HTTP_NOW = time2str $NOW;
30})->now; 37};
38$update_time->invoke;
31 39
32if ($ERROR_LOG) { 40if ($ERROR_LOG) {
33 use IO::Handle; 41 use IO::Handle;
34 open $errorlog, ">>$ERROR_LOG" 42 open $errorlog, ">>$ERROR_LOG"
35 or die "$ERROR_LOG: $!"; 43 or die "$ERROR_LOG: $!";
49 my $NOW = (POSIX::strftime "%Y-%m-%d %H:%M:%S", gmtime $::NOW); 57 my $NOW = (POSIX::strftime "%Y-%m-%d %H:%M:%S", gmtime $::NOW);
50 printf "$NOW: $format\n", @_; 58 printf "$NOW: $format\n", @_;
51 printf $errorlog "$NOW: $format\n", @_ if $errorlog; 59 printf $errorlog "$NOW: $format\n", @_ if $errorlog;
52} 60}
53 61
54our $connections = new Coro::Semaphore $MAX_CONNECTS || 250; 62our $connections = new Coro::Semaphore $::MAX_CONNECTS || 250;
55our $httpevent = new Coro::Signal; 63our $httpevent = new Coro::Signal;
56 64
57our $queue_file = new transferqueue $MAX_TRANSFERS; 65our $queue_file = new transferqueue $::MAX_TRANSFERS;
58our $queue_index = new transferqueue 10; 66our $queue_index = new transferqueue 10;
59 67
60my @newcons; 68our $tbf_top = new tbf rate => $::TBF_RATE || 100000;
61my @pool;
62 69
63# one "execution thread" 70my $unused_bytes = 0;
64sub handler { 71my $unused_last = time;
65 while () {
66 if (@newcons) {
67 eval {
68 conn->new(@{pop @newcons})->handle;
69 };
70 slog 1, "$@" if $@ && !ref $@;
71 72
72 $httpevent->broadcast; # only for testing, but doesn't matter much 73sub unused_bandwidth {
73 74 $unused_bytes += $_[0];
74 $connections->up; 75 if ($unused_last < $NOW - 30 && $unused_bytes / ($NOW - $unused_last) > 50000) {
75 } else { 76 $unused_last = $NOW;
76 last if @pool >= $MAX_POOL; 77 $unused_bytes = 0;
77 push @pool, $Coro::current; 78 $queue_file->force_wake_next
78 schedule; 79 and slog 1, "forced filetransfer due to unused bandwidth";
79 }
80 } 80 }
81} 81}
82 82
83sub listen_on { 83sub listen_on {
84 my $listen = $_[0]; 84 my $listen = $_[0];
88 # the "main thread" 88 # the "main thread"
89 async { 89 async {
90 slog 1, "accepting connections"; 90 slog 1, "accepting connections";
91 while () { 91 while () {
92 $connections->down; 92 $connections->down;
93 push @newcons, [$listen->accept]; 93 my @conn = $listen->accept;
94 #slog 3, "accepted @$connections ".scalar(@pool); 94 #slog 3, "accepted @$connections ".scalar(@pool);
95 if (@pool) { 95
96 (pop @pool)->ready; 96 async_pool {
97 } else { 97 eval {
98 async \&handler; 98 conn->new (@conn)->handle;
99 } 99 };
100 slog 1, "$@" if $@ && !ref $@;
100 101
102 $httpevent->broadcast; # only for testing, but doesn't matter much
103
104 $connections->up;
105 }
101 } 106 }
102 }; 107 };
103} 108}
104 109
105my $http_port = new Coro::Socket 110my $http_port = new Coro::Socket
106 LocalAddr => $SERVER_HOST, 111 LocalAddr => $::SERVER_HOST,
107 LocalPort => $SERVER_PORT, 112 LocalPort => $::SERVER_PORT,
108 ReuseAddr => 1, 113 ReuseAddr => 1,
109 Listen => 50, 114 Listen => 50,
110 or die "unable to start server"; 115 or die "unable to start server";
111 116
112listen_on $http_port; 117listen_on $http_port;
113 118
114if ($SERVER_PORT2) { 119if ($::SERVER_PORT2) {
115 my $http_port = new Coro::Socket 120 my $http_port = new Coro::Socket
116 LocalAddr => $SERVER_HOST, 121 LocalAddr => $::SERVER_HOST,
117 LocalPort => $SERVER_PORT2, 122 LocalPort => $::SERVER_PORT2,
118 ReuseAddr => 1, 123 ReuseAddr => 1,
119 Listen => 50, 124 Listen => 50,
120 or die "unable to start server"; 125 or die "unable to start server";
121 126
122 listen_on $http_port; 127 listen_on $http_port;
123} 128}
124 129
125package conn; 130package conn;
131
132use common::sense;
126 133
127use Socket; 134use Socket;
128use HTTP::Date; 135use HTTP::Date;
129use Convert::Scalar 'weaken'; 136use Convert::Scalar 'weaken';
130use Linux::AIO; 137use IO::AIO;
131 138
132Linux::AIO::min_parallel $::AIO_PARALLEL; 139IO::AIO::min_parallel $::AIO_PARALLEL;
133 140
134Event->io(fd => Linux::AIO::poll_fileno, 141our $AIO_WATCHER = EV::io IO::AIO::poll_fileno, EV::READ, \&IO::AIO::poll_cb;
135 poll => 'r', async => 1,
136 cb => \&Linux::AIO::poll_cb);
137 142
138our %conn; # $conn{ip}{self} => connobj 143our %conn; # $conn{ip}{self} => connobj
139our %uri; # $uri{ip}{uri}{self} 144our %uri; # $uri{ip}{uri}{self}
140our %blocked; 145our %blocked;
141our %mimetype; 146our %mimetype;
142 147
143sub read_mimetypes { 148sub read_mimetypes {
144 local *M;
145 if (open M, "<mime_types") { 149 if (open my $fh, "<mime_types") {
146 while (<M>) { 150 while (<$fh>) {
147 if (/^([^#]\S+)\t+(\S+)$/) { 151 if (/^([^#]\S+)\t+(\S+)$/) {
148 $mimetype{lc $1} = $2; 152 $mimetype{lc $1} = $2;
149 } 153 }
150 } 154 }
151 } else { 155 } else {
159 my $class = shift; 163 my $class = shift;
160 my $fh = shift; 164 my $fh = shift;
161 my $peername = shift; 165 my $peername = shift;
162 my $self = bless { fh => $fh }, $class; 166 my $self = bless { fh => $fh }, $class;
163 my (undef, $iaddr) = unpack_sockaddr_in $peername 167 my (undef, $iaddr) = unpack_sockaddr_in $peername
164 or $self->err(500, "unable to decode peername"); 168 or $self->err (500, "unable to decode peername");
165 169
166 $self->{remote_addr} = 170 $self->{remote_addr} =
167 $self->{remote_id} = inet_ntoa $iaddr; 171 $self->{remote_id} = inet_ntoa $iaddr;
168 172
169 $self->{time} = $::NOW; 173 $self->{time} = $::NOW;
170 174
171 weaken ($Coro::current->{conn} = $self); 175 weaken ($Coro::current->{conn} = $self);
172 176
173 $::conns++; 177 ++$::conns;
174 $::maxconns = $::conns if $::conns > $::maxconns; 178 $::maxconns = $::conns if $::conns > $::maxconns;
175 179
176 $self; 180 $self
177} 181}
178 182
179sub DESTROY { 183sub DESTROY {
180 #my $self = shift; 184 my $self = shift;
185
181 $::conns--; 186 --$::conns;
182} 187}
188
189sub prune_cache {
190 my $hash = $_[0];
191
192 for (keys %$hash) {
193 if (ref $hash->{$_} eq HASH::) {
194 prune_cache($hash->{$_});
195 unless (scalar keys %{$hash->{$_}}) {
196 delete $hash->{$_};
197 }
198 }
199 }
200}
201
202sub prune_caches {
203 prune_cache \%conn;
204 prune_cache \%uri;
205
206 for (keys %blocked) {
207 delete $blocked{$_} unless $blocked{$_}[0] > $::NOW;
208 }
209}
210
211our $PRUNE_WATCHER = EV::timer 60, 60, \&prune_caches;
183 212
184sub slog { 213sub slog {
185 my $self = shift; 214 my $self = shift;
186 main::slog($_[0], "$self->{remote_id}> $_[1]"); 215 main::slog($_[0], "$self->{remote_id}> $_[1]");
187} 216}
217 $hdr->{"Content-Length"} = length $content; 246 $hdr->{"Content-Length"} = length $content;
218 $GZ = sprintf "GZ%02d", 100 - 100*((length $content) / $orig); 247 $GZ = sprintf "GZ%02d", 100 - 100*((length $content) / $orig);
219 } 248 }
220 249
221 $res .= "Date: $HTTP_NOW\015\012"; 250 $res .= "Date: $HTTP_NOW\015\012";
251 $res .= "Server: $::NAME\015\012";
222 252
223 while (my ($h, $v) = each %$hdr) { 253 while (my ($h, $v) = each %$hdr) {
224 $res .= "$h: $v\015\012" 254 $res .= "$h: $v\015\012"
225 } 255 }
226 $res .= "\015\012"; 256 $res .= "\015\012";
232 " \"$self->{h}{referer}\"\n"; 262 " \"$self->{h}{referer}\"\n";
233 263
234 print $::accesslog $log if $::accesslog; 264 print $::accesslog $log if $::accesslog;
235 print STDERR $log; 265 print STDERR $log;
236 266
237 $self->{written} += 267 $tbf_top->request(length $res, 1e6);
238 print {$self->{fh}} $res; 268 $self->{written} += print {$self->{fh}} $res;
239} 269}
240 270
241sub err { 271sub err {
242 my $self = shift; 272 my $self = shift;
243 my ($code, $msg, $hdr, $content) = @_; 273 my ($code, $msg, $hdr, $content) = @_;
247 $hdr->{"Content-Type"} = "text/plain"; 277 $hdr->{"Content-Type"} = "text/plain";
248 $hdr->{"Content-Length"} = length $content; 278 $hdr->{"Content-Length"} = length $content;
249 } 279 }
250 $hdr->{"Connection"} = "close"; 280 $hdr->{"Connection"} = "close";
251 281
252 $self->response($code, $msg, $hdr, $content); 282 $self->response ($code, $msg, $hdr, $content);
253 283
254 die bless {}, err::; 284 die bless {}, err::
255} 285}
256 286
257sub handle { 287sub handle {
258 my $self = shift; 288 my $self = shift;
259 my $fh = $self->{fh}; 289 my $fh = $self->{fh};
260 290
261 my $host; 291 my $host;
262 292
263 $fh->timeout($::REQ_TIMEOUT); 293 $fh->timeout($::REQ_TIMEOUT);
264 while() { 294 while () {
265 $self->{reqs}++; 295 $self->{reqs}++;
266 296
267 # read request and parse first line 297 # read request and parse first line
268 my $req = $fh->readline("\015\012\015\012"); 298 my $req = $fh->readline("\015\012\015\012");
269 299
298 my (%hdr, $h, $v); 328 my (%hdr, $h, $v);
299 329
300 $hdr{lc $1} .= ",$2" 330 $hdr{lc $1} .= ",$2"
301 while $req =~ /\G 331 while $req =~ /\G
302 ([^:\000-\040]+): 332 ([^:\000-\040]+):
303 [\010\040]* 333 [\011\040]*
304 ((?: [^\015\012]+ | \015\012[\010\040] )*) 334 ((?: [^\015\012]+ | \015\012[\011\040] )*)
305 \015\012 335 \015\012
306 /gxc; 336 /gxc;
307 337
308 $req =~ /\G\015\012$/ 338 $req =~ /\G\015\012$/
309 or $self->err(400, "bad request"); 339 or $self->err(400, "bad request");
378# uri => path mapping 408# uri => path mapping
379sub map_uri { 409sub map_uri {
380 my $self = shift; 410 my $self = shift;
381 my $host = $self->{server_name}; 411 my $host = $self->{server_name};
382 my $uri = $self->{uri}; 412 my $uri = $self->{uri};
413
414 $host =~ /[\/\\]/
415 and $self->err(400, "bad request");
383 416
384 # some massaging, also makes it more secure 417 # some massaging, also makes it more secure
385 $uri =~ s/%([0-9a-fA-F][0-9a-fA-F])/chr hex $1/ge; 418 $uri =~ s/%([0-9a-fA-F][0-9a-fA-F])/chr hex $1/ge;
386 $uri =~ s%//+%/%g; 419 $uri =~ s%//+%/%g;
387 $uri =~ s%/\.(?=/|$)%%g; 420 $uri =~ s%/\.(?=/|$)%%g;
431 464
432 if ($self->{name} =~ s%^/internal/([^/]+)%%) { 465 if ($self->{name} =~ s%^/internal/([^/]+)%%) {
433 if ($::internal{$1}) { 466 if ($::internal{$1}) {
434 $::internal{$1}->($self); 467 $::internal{$1}->($self);
435 } else { 468 } else {
436 $self->err(404, "not found"); 469 $self->err (404, "not found");
437 } 470 }
438 } else { 471 } else {
439 472
440 stat $path 473 Coro::AIO::aio_stat $path
441 or $self->err(404, "not found"); 474 and $self->err (404, "not found");
442 475
443 $self->{stat} = [stat _]; 476 $self->{stat} = [stat _];
444 477
445 # idiotic netscape sends idiotic headers AGAIN 478 # idiotic netscape sends idiotic headers AGAIN
446 my $ims = $self->{h}{"if-modified-since"} =~ /^([^;]+)/ 479 my $ims = $self->{h}{"if-modified-since"} =~ /^([^;]+)/
449 if (-d _ && -r _) { 482 if (-d _ && -r _) {
450 # directory 483 # directory
451 if ($path !~ /\/$/) { 484 if ($path !~ /\/$/) {
452 # create a redirect to get the trailing "/" 485 # create a redirect to get the trailing "/"
453 # we don't try to avoid the :80 486 # we don't try to avoid the :80
454 $self->err(301, "moved permanently", { Location => "http://".$self->server_hostport."$self->{uri}/" }); 487 $self->err (301, "moved permanently", { Location => "http://".$self->server_hostport."$self->{uri}/" });
455 } else { 488 } else {
456 $ims < $self->{stat}[9] 489 $ims < $self->{stat}[9]
457 or $self->err(304, "not modified"); 490 or $self->err (304, "not modified");
458 491
459 if (-r "$path/index.html") { 492 if (-r "$path/index.html") {
460 # replace directory "size" by index.html filesize 493 # replace directory "size" by index.html filesize
461 $self->{stat} = [stat ($self->{path} .= "/index.html")]; 494 $self->{stat} = [stat ($self->{path} .= "/index.html")];
462 $self->handle_file($queue_index); 495 $self->handle_file ($queue_index, $tbf_top);
463 } else { 496 } else {
464 $self->handle_dir; 497 $self->handle_dir;
465 } 498 }
466 } 499 }
467 } elsif (-f _ && -r _) { 500 } elsif (-f _ && -r _) {
468 -x _ and $self->err(403, "forbidden"); 501 -x _ and $self->err (403, "forbidden");
469 502
470 if (keys %{$conn{$self->{remote_id}}} > $::MAX_TRANSFERS_IP) { 503 if (keys %{$conn{$self->{remote_id}}} > $::MAX_TRANSFERS_IP) {
471 my $timeout = $::NOW + 10; 504 my $timeout = $::NOW + 10;
472 while (keys %{$conn{$self->{remote_id}}} > $::MAX_TRANSFERS_IP) { 505 while (keys %{$conn{$self->{remote_id}}} > $::MAX_TRANSFERS_IP) {
473 if ($timeout < $::NOW) { 506 if ($timeout < $::NOW) {
476 $httpevent->wait; 509 $httpevent->wait;
477 } 510 }
478 } 511 }
479 } 512 }
480 513
481 $self->handle_file($queue_file); 514 $self->handle_file ($queue_file, $tbf_top);
482 } else { 515 } else {
483 $self->err(404, "not found"); 516 $self->err (404, "not found");
484 } 517 }
485 } 518 }
486} 519}
487 520
488sub handle_dir { 521sub handle_dir {
489 my $self = shift; 522 my $self = shift;
490 my $idx = $self->diridx; 523 my $idx = $self->diridx;
491 524
492 $self->response(200, "ok", 525 $self->response (200, "ok",
493 { 526 {
494 "Content-Type" => "text/html", 527 "Content-Type" => "text/html; charset=utf-8",
495 "Content-Length" => length $idx, 528 "Content-Length" => length $idx,
496 "Last-Modified" => time2str ($self->{stat}[9]), 529 "Last-Modified" => time2str ($self->{stat}[9]),
497 }, 530 },
498 $idx); 531 $idx);
499} 532}
500 533
501sub handle_file { 534sub handle_file {
502 my ($self, $queue) = @_; 535 my ($self, $queue, $tbf) = @_;
503 my $length = $self->{stat}[7]; 536 my $length = $self->{stat}[7];
504 my $hdr = { 537 my $hdr = {
505 "Last-Modified" => time2str ((stat _)[9]), 538 "Last-Modified" => time2str ((stat _)[9]),
539 "Accept-Ranges" => "bytes",
506 }; 540 };
507 541
508 my @code = (200, "ok"); 542 my @code = (200, "ok");
509 my ($l, $h); 543 my ($l, $h);
510 544
511 if ($self->{h}{range} =~ /^bytes=(.*)$/) { 545 if ($self->{h}{range} =~ /^bytes=(.*)$/i) {
512 for (split /,/, $1) { 546 for (split /,/, $1) {
513 if (/^-(\d+)$/) { 547 if (/^-(\d+)$/) {
514 ($l, $h) = ($length - $1, $length - 1); 548 ($l, $h) = ($length - $1, $length - 1);
515 } elsif (/^(\d+)-(\d*)$/) { 549 } elsif (/^(\d+)-(\d*)$/) {
516 ($l, $h) = ($1, ($2 ne "" || $2 >= $length) ? $2 : $length - 1); 550 ($l, $h) = ($1, ($2 ne "" || $2 >= $length) ? $2 : $length - 1);
520 } 554 }
521 goto satisfiable if $l >= 0 && $l < $length && $h >= 0 && $h >= $l; 555 goto satisfiable if $l >= 0 && $l < $length && $h >= 0 && $h >= $l;
522 } 556 }
523 $hdr->{"Content-Range"} = "bytes */$length"; 557 $hdr->{"Content-Range"} = "bytes */$length";
524 $hdr->{"Content-Length"} = $length; 558 $hdr->{"Content-Length"} = $length;
525 $self->err(416, "not satisfiable", $hdr, ""); 559 $self->err (416, "not satisfiable", $hdr, "");
526 560
527satisfiable: 561satisfiable:
528 # check for segmented downloads 562 # check for segmented downloads
529 if ($l && $::NO_SEGMENTED) { 563 if ($l && $::NO_SEGMENTED) {
530 my $timeout = $::NOW + 15; 564 my $timeout = $::NOW + 15;
531 while (keys %{$uri{$self->{remote_id}}{$self->{uri}}} > 1) { 565 while (keys %{$uri{$self->{remote_id}}{$self->{uri}}} > 1) {
532 if ($timeout <= $::NOW) { 566 if ($timeout <= $::NOW) {
533 $self->block($::BLOCKTIME, "segmented downloads are forbidden"); 567 $self->block ($::BLOCKTIME, "segmented downloads are forbidden");
534 #$self->err_segmented_download; 568 #$self->err_segmented_download;
535 } else { 569 } else {
536 $httpevent->wait; 570 $httpevent->wait;
537 } 571 }
538 } 572 }
549 583
550 $self->{path} =~ /\.([^.]+)$/; 584 $self->{path} =~ /\.([^.]+)$/;
551 $hdr->{"Content-Type"} = $mimetype{lc $1} || "application/octet-stream"; 585 $hdr->{"Content-Type"} = $mimetype{lc $1} || "application/octet-stream";
552 $hdr->{"Content-Length"} = $length; 586 $hdr->{"Content-Length"} = $length;
553 587
554 $self->response(@code, $hdr, ""); 588 $self->response (@code, $hdr, "");
555 589
556 if ($self->{method} eq "GET") { 590 if ($self->{method} eq "GET") {
557 $self->{time} = $::NOW; 591 $self->{time} = $::NOW;
592 $self->{written} = 0;
558 593
559 my $current = $Coro::current; 594 my $fh = Coro::AIO::aio_open $self->{path}, Fcntl::O_RDONLY, 0
560
561 my ($fh, $buf, $r);
562
563 open $fh, "<", $self->{path}
564 or die "$self->{path}: late open failure ($!)"; 595 or die "$self->{path}: late open failure ($!)";
565 596
566 $h -= $l - 1; 597 $h -= $l - 1;
567 598
568 if (0) { # !AIO
569 if ($l) {
570 sysseek $fh, $l, 0;
571 }
572 }
573
574 my $transfer = $queue->start_transfer($h); 599 my $transfer = $queue->start_transfer ($h);
575 my $locked; 600 my $locked;
576 my $bufsize = $::WAIT_BUFSIZE; # initial buffer size 601 my $bufsize = $::WAIT_BUFSIZE; # initial buffer size
577 602
578 while ($h > 0) { 603 while ($h > 0) {
604 Coro::cede;
605 my $transfer_lock = $TRANSFER_LOCK->guard ($self->{remote_id});
606
579 unless ($locked) { 607 unless ($locked) {
580 if ($locked ||= $transfer->try($::WAIT_INTERVAL)) { 608 if ($locked ||= $transfer->try ($::WAIT_INTERVAL)) {
581 $bufsize = $::BUFSIZE; 609 $bufsize = $::BUFSIZE;
582 $self->{time} = $::NOW; 610 $self->{time} = $::NOW;
611 $self->{written} = 0;
583 } 612 }
584 } 613 }
585 614
586 if ($blocked{$self->{remote_id}}) { 615 if ($blocked{$self->{remote_id}}) {
587 $self->{h}{connection} = "close"; 616 $self->{h}{connection} = "close";
588 die bless {}, err::; 617 die bless {}, err::;
589 } 618 }
590 619
591 if (0) { # !AIO 620 Coro::AIO::aio_read $fh, $l, ($h > $bufsize ? $bufsize : $h), my $buf, 0
592 sysread $fh, $buf, $h > $bufsize ? $bufsize : $h
593 or last; 621 or last;
594 } else { 622
595 aio_read($fh, $l, ($h > $bufsize ? $bufsize : $h), 623 $tbf->request (length $buf);
596 $buf, 0, sub { 624 my $w = $self->{fh}->syswrite ($buf)
597 $r = $_[0];
598 Coro::ready($current);
599 });
600 &Coro::schedule;
601 last unless $r;
602 }
603 my $w = syswrite $self->{fh}, $buf
604 or last; 625 or last;
605 $::written += $w; 626 $::written += $w;
606 $self->{written} += $w; 627 $self->{written} += $w;
607 $l += $r; 628 $l += $w;
608 } 629 }
609 630
610 close $fh; 631 close $fh;
611 } 632 }
612} 633}
613 634
6141; 6351
636

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines