Skip to content

Commit 52450ea

Browse files
committed
Cleanup tests, fix deps in META
1 parent 8941519 commit 52450ea

File tree

8 files changed

+33
-85
lines changed

8 files changed

+33
-85
lines changed

META.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
"requires" : {
3535
"AnyEvent" : "5",
3636
"Digest::SHA1" : "2",
37-
"HTTP::Easy" : "0.03",
37+
"HTTP::Easy" : "0.02",
3838
"JSON::XS" : "3"
3939
}
4040
}
4141
},
4242
"release_status" : "stable",
43-
"version" : "1.99994",
43+
"version" : "1.99995",
4444
"x_serialization_backend" : "JSON::PP version 4.06"
4545
}

META.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ no_index:
2020
requires:
2121
AnyEvent: '5'
2222
Digest::SHA1: '2'
23-
HTTP::Easy: '0.03'
23+
HTTP::Easy: '0.02'
2424
JSON::XS: '3'
25-
version: '1.99994'
25+
version: '1.99995'
2626
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

lib/AnyEvent/HTTP/Server.pm

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,11 @@ AnyEvent::HTTP::Server - AnyEvent HTTP/1.1 Server
88

99
our $VERSION;
1010
BEGIN{
11-
$VERSION = '1.99994';
11+
$VERSION = '1.99995';
1212
}
1313

14-
#use common::sense;
15-
#use 5.008008;
16-
#use strict;
17-
#use warnings;
18-
#no warnings 'uninitialized';
19-
#use mro 'c3';
2014
use AnyEvent::HTTP::Server::Kit;
2115

22-
#use Exporter;
23-
#our @ISA = qw(Exporter);
24-
#our @EXPORT_OK = our @EXPORT = qw(http_server);
25-
2616
use AnyEvent;
2717
use AnyEvent::Socket;
2818
use AnyEvent::Handle;
@@ -37,8 +27,6 @@ use Compress::Zlib ();
3727
use MIME::Base64 ();
3828
use Time::HiRes qw/gettimeofday/;
3929

40-
#use Carp 'croak';
41-
4230
use AnyEvent::HTTP::Server::Req;
4331

4432
our $MIME = Encode::find_encoding('MIME-Header');
@@ -593,14 +581,8 @@ sub incoming {
593581
#warn "call for part $hd{name} ($last)";
594582
$cb->( $last && $idx == -1 ? 1 : 0,$part,\%hd );
595583
}
596-
#warn "just return";
597-
#if ($last) {
598-
#warn "leave with $body";
599-
#}
600584
};
601585
}
602-
# elsif ( $h{'content-type'} =~ m{^application/x-www-form-urlencoded(?:\Z|\s*;)}i and exists $rv[0]{form} ) {
603-
604586
elsif ( exists $rv[0]{form} ) {
605587
my $body = '';
606588
$r{on_body} = sub {
@@ -792,47 +774,6 @@ sub graceful {
792774
1; # End of AnyEvent::HTTP::Server
793775
__END__
794776
795-
sub http_server($$&) {
796-
my ($lhost,$lport,$reqcb) = @_;
797-
798-
# TBD
799-
800-
return $self;
801-
}
802-
803-
sub __old_stop {
804-
my ($self,$cb) = @_;
805-
delete $self->{aw};
806-
close $self->{socket};
807-
if (%{$self->{con}}) {
808-
$log->debugf("Server have %d active connectinos while stopping...", 0+keys %{$self->{con}});
809-
my $cv = &AE::cv( $cb );
810-
$cv->begin;
811-
for my $key ( keys %{$self->{con}} ) {
812-
my $con = $self->{con}{$key};
813-
$log->debug("$key: connection from $con->{host}:$con->{port}: $con->{state}");
814-
if ($con->{state} eq 'idle' or $con->{state} eq 'closed') {
815-
$con->close;
816-
delete $self->{con}{$key};
817-
use Devel::FindRef;
818-
warn "closed <$con> ".Devel::FindRef::track $con;
819-
} else {
820-
$cv->begin;
821-
$con->{close} = sub {
822-
$log->debug("Connection $con->{host}:$con->{port} was closed");
823-
$cv->end;
824-
};
825-
}
826-
}
827-
if (%{$self->{con}}) {
828-
$log->debug("Still have @{[ 0+keys %{$self->{con}} ]}");
829-
}
830-
$cv->end;
831-
} else {
832-
$cb->();
833-
}
834-
}
835-
836777
=head1 SYNOPSIS
837778
838779
use AnyEvent::HTTP::Server;

lib/AnyEvent/HTTP/Server/Req.pm

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -304,23 +304,12 @@ BEGIN {
304304
#return $self->headers(@_) if @_ % 2;
305305
my ($code,$content,%args) = @_;
306306
$code ||=200;
307-
#if (ref $content) {
308-
# if (ref $content eq 'HASH' and $content->{sendfile}) {
309-
# $content->{size} = -s $content->{sendfile};
310-
# }
311-
# else {
312-
# croak "Unknown type of content: $content";
313-
# }
314-
#
315-
#} else {
316-
utf8::encode $content if utf8::is_utf8 $content;
317-
#}
307+
utf8::encode $content if utf8::is_utf8 $content;
318308
my $reply = "HTTP/$self->{version} $code $http{$code}$LF";
319309
my @good;my @bad;
320310
my $h = {
321311
server => $Server,
322312
%{ $args{headers} || {} },
323-
#'connection' => 'close',
324313
'connection' => ( $args{headers} && $args{headers}{connection} ) ? $args{headers}{connection} : $self->connection,
325314
};
326315
if ($self->method ne 'HEAD') {

t/01-basic-ae.t

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#use strict;
2+
#use uni::perl ':dumper';
3+
4+
use AnyEvent::Socket;
5+
use AnyEvent::Handle;
6+
use AnyEvent::HTTP::Server;
7+
use AnyEvent::HTTP::Server::Kit ':dumper';
8+
use AnyEvent::Loop;
9+
use FindBin;
10+
11+
do "$FindBin::Bin/basic.pl" or die "$FindBin::Bin/basic.pl: ".($@ ? $@ : $!);

t/02-basic-ev.t

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#use strict;
2+
#use uni::perl ':dumper';
3+
4+
use AnyEvent::Socket;
5+
use AnyEvent::Handle;
6+
use AnyEvent::HTTP::Server;
7+
use AnyEvent::HTTP::Server::Kit ':dumper';
8+
use Test::More;
9+
BEGIN{
10+
eval { require EV; 1 } or plan skip_all => "EV not installed";
11+
}
12+
use FindBin;
13+
14+
do "$FindBin::Bin/basic.pl" or die "$FindBin::Bin/basic.pl: $!";
File renamed without changes.

t/01-basic.t renamed to t/basic.pl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
#!/usr/bin/env perl
22

3-
#use strict;
4-
#use uni::perl ':dumper';
5-
6-
use AnyEvent::Socket;
7-
use AnyEvent::Handle;
8-
use AnyEvent::HTTP::Server;
9-
use AnyEvent::HTTP::Server::Kit ':dumper';
10-
use EV;
113
use Test::More tests => 194;
124
use Data::Dumper;
5+
use FindBin;
6+
use lib "$FindBin::Bin/..";
137
$Data::Dumper::Useqq = 1;
148

159
use t::testlib;
@@ -264,4 +258,3 @@
264258
}
265259

266260
done_testing();
267-

0 commit comments

Comments
 (0)