1 |
tove 08/08/26 08:04:44 |
2 |
|
3 |
Added: 0.34-debian.patch |
4 |
Log: |
5 |
Version bump (#235674). Added debian patch for CPAN#28122 |
6 |
(Portage version: 2.2_rc8/cvs/Linux 2.6.26-tuxonice i686) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 dev-perl/HTTP-Server-Simple/files/0.34-debian.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-perl/HTTP-Server-Simple/files/0.34-debian.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-perl/HTTP-Server-Simple/files/0.34-debian.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: 0.34-debian.patch |
15 |
=================================================================== |
16 |
http://rt.cpan.org/Public/Bug/Display.html?id=28122 |
17 |
patches from libhttp-server-simple-perl_0.34-1.diff.gz |
18 |
|
19 |
--- libhttp-server-simple-perl.orig/t/01live.t |
20 |
+++ libhttp-server-simple-perl/t/01live.t |
21 |
@@ -34,11 +34,7 @@ |
22 |
} |
23 |
|
24 |
|
25 |
-TODO: { |
26 |
- local $TODO = "We don't currently wait for 'server is running' responses from the client"; |
27 |
- run_server_tests('SlowServer'); |
28 |
- |
29 |
-} |
30 |
+run_server_tests('SlowServer'); |
31 |
|
32 |
|
33 |
|
34 |
--- libhttp-server-simple-perl.orig/lib/HTTP/Server/Simple.pm |
35 |
+++ libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm |
36 |
@@ -6,6 +6,7 @@ |
37 |
use Socket; |
38 |
use Carp; |
39 |
use URI::Escape; |
40 |
+use IO::Select; |
41 |
|
42 |
use vars qw($VERSION $bad_request_doc); |
43 |
$VERSION = '0.34'; |
44 |
@@ -215,15 +216,36 @@ |
45 |
|
46 |
sub background { |
47 |
my $self = shift; |
48 |
+ |
49 |
+ # set up a pipe so the child can tell the parent when it's ready |
50 |
+ # to accept requests |
51 |
+ my ($readfh, $writefh) = FileHandle::pipe; |
52 |
+ |
53 |
my $child = fork; |
54 |
die "Can't fork: $!" unless defined($child); |
55 |
- return $child if $child; |
56 |
+ if ($child) { # parent |
57 |
+ my $s = IO::Select->new; |
58 |
+ $s->add($readfh); |
59 |
+ my $now = time; my $left = 0; |
60 |
+ my @ready; |
61 |
+ while(not @ready and $left < 5) { |
62 |
+ @ready = $s->can_read($left); |
63 |
+ $left = time - $now; |
64 |
+ } |
65 |
+ die("child unresponsive for 5 seconds") if(not @ready); |
66 |
+ my $response = <$readfh>; |
67 |
+ chomp $response; |
68 |
+ die("child is confused: answer '$response' != 'OK'") |
69 |
+ if $response ne "OK"; |
70 |
+ return $child; |
71 |
+ } |
72 |
|
73 |
if ( $^O !~ /MSWin32/ ) { |
74 |
require POSIX; |
75 |
POSIX::setsid() |
76 |
or die "Can't start a new session: $!"; |
77 |
} |
78 |
+ $self->{_parent_handle} = $writefh; |
79 |
$self->run(); |
80 |
} |
81 |
|
82 |
@@ -270,6 +292,7 @@ |
83 |
$self->after_setup_listener(); |
84 |
*{"$pkg\::run"} = $self->_default_run; |
85 |
} |
86 |
+ $self->_maybe_tell_parent(); |
87 |
|
88 |
local $SIG{HUP} = sub { $SERVER_SHOULD_RUN = 0; }; |
89 |
|
90 |
@@ -407,6 +430,15 @@ |
91 |
} |
92 |
} |
93 |
|
94 |
+sub _maybe_tell_parent { |
95 |
+ # inform the parent process that we're ready, if applicable |
96 |
+ my $self = shift; |
97 |
+ my $handle = $self->{_parent_handle}; |
98 |
+ return if !$handle; |
99 |
+ print $handle "OK\n"; |
100 |
+ close $handle; |
101 |
+ delete $self->{_parent_handle}; |
102 |
+} |