line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache2::Controller::Log::DetectAbortedConnection; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# fwhew! that was a mouthful. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Apache2::Controller::Log::DetectAbortedConnection - |
8
|
|
|
|
|
|
|
helper handler for detecting cancelled connections to the client. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 1.001.001 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
1854
|
use version; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
17
|
|
|
|
|
|
|
our $VERSION = version->new('1.001.001'); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
You don't need to use this handler, probably. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This is pushed internally by L |
24
|
|
|
|
|
|
|
to detect in the PerlLogHandler phase if the connection has |
25
|
|
|
|
|
|
|
been broken to the client before the server closes the connection. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
So far it's only useful for the session, and because we now |
28
|
|
|
|
|
|
|
use a C for session saving instead of the |
29
|
|
|
|
|
|
|
C in prior versions. Using a |
30
|
|
|
|
|
|
|
C caused |
31
|
|
|
|
|
|
|
problems with synchronicity since the test scripts would |
32
|
|
|
|
|
|
|
fire off a new request before Apache was done processing |
33
|
|
|
|
|
|
|
the session saving from the prior request... I don't know |
34
|
|
|
|
|
|
|
why it did this under prefork with C, |
35
|
|
|
|
|
|
|
but it did. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
So, I'm leaving it separate just in case it is useful for |
38
|
|
|
|
|
|
|
something else in the future. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 FUNCTIONS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 handler |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Sets C<< $r->pnotes->{a2c}{connection_aborted} >> with the |
45
|
|
|
|
|
|
|
boolean results of C<< $r->connection->aborted() >> and returns. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
I am not entirely sure why to cache this except that I couldn't |
48
|
|
|
|
|
|
|
figure out any other way to manually override this state |
49
|
|
|
|
|
|
|
even if you didn't abort the connection, if that's useful. |
50
|
|
|
|
|
|
|
I may be over-planning here. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
|
89
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
55
|
1
|
|
|
1
|
|
5
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
42
|
|
|
1
|
|
|
|
|
37
|
|
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
1
|
|
427
|
use Apache2::Connection (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
use Apache2::RequestRec (); |
59
|
|
|
|
|
|
|
use Apache2::Const -compile => qw( OK ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
use Log::Log4perl qw(:easy); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub handler { |
64
|
|
|
|
|
|
|
my ($r) = @_; |
65
|
|
|
|
|
|
|
DEBUG "detecting aborted connection..."; |
66
|
|
|
|
|
|
|
$r->pnotes->{a2c}{connection_aborted} ||= $r->connection->aborted(); |
67
|
|
|
|
|
|
|
return Apache2::Const::OK; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SEE ALSO |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
L, |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L, |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Mark Hedges, C<< >> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Copyright 2008-2010 Mark Hedges, all rights reserved. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
87
|
|
|
|
|
|
|
under the same terms as Perl itself. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is provided as-is, with no warranty |
90
|
|
|
|
|
|
|
and no guarantee of fitness |
91
|
|
|
|
|
|
|
for any particular purpose. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|