line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache::MagicPOST; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005_62; |
4
|
1
|
|
|
1
|
|
24311
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
5
|
1
|
|
|
1
|
|
7
|
use vars qw($VERSION @EXPORTER @ISA); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
84
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
45
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
1
|
|
|
1
|
|
1832
|
use AutoLoader qw(AUTOLOAD); |
|
1
|
|
|
|
|
1684
|
|
|
1
|
|
|
|
|
6
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw(); |
14
|
|
|
|
|
|
|
our $VERSION = '1.2'; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
701
|
use Apache::Constants qw(:common ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Apache::Request; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# ******************************************** |
21
|
|
|
|
|
|
|
# This module isn't usable, it destroys POST |
22
|
|
|
|
|
|
|
# data for subsequent handlers ;-( |
23
|
|
|
|
|
|
|
# ******************************************** |
24
|
|
|
|
|
|
|
sub _handler { |
25
|
|
|
|
|
|
|
my $r = shift; |
26
|
|
|
|
|
|
|
return DECLINED unless $r->method() eq 'POST' ; |
27
|
|
|
|
|
|
|
return DECLINED unless ($r->header_in('Content-type') eq 'application/x-www-form-urlencoded'); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $method_param_name = $r->dir_config('MagicPOSTMethodParamName'); |
30
|
|
|
|
|
|
|
$method_param_name = 'method' unless ( $method_param_name ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my %params = $r->content; |
33
|
|
|
|
|
|
|
return DECLINED unless ( exists ( $params{$method_param_name} )); |
34
|
|
|
|
|
|
|
$r->method( $params{$method_param_name} ); |
35
|
|
|
|
|
|
|
delete $params{$method_param_name}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
foreach(keys %params) |
38
|
|
|
|
|
|
|
{ |
39
|
|
|
|
|
|
|
$r->header_in( $_ => $params{$_} ); |
40
|
|
|
|
|
|
|
delete $params{$_}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
$r->header_in( 'Content-length' => undef ); |
43
|
|
|
|
|
|
|
$r->header_in( 'Content-type' => undef ); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
return OK; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |