projects
/
HTTP-Proxy-Archive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
create var dir if needed
[HTTP-Proxy-Archive.git]
/
proxy.pl
diff --git
a/proxy.pl
b/proxy.pl
index
590da2d
..
f6fc12b
100755
(executable)
--- a/
proxy.pl
+++ b/
proxy.pl
@@
-14,6
+14,7
@@
use Data::Dump qw(dump);
sub var_save {
my ( $dir, $name, $value ) = @_;
$value ||= "\n";
sub var_save {
my ( $dir, $name, $value ) = @_;
$value ||= "\n";
+ mkdir 'var' unless -e 'var';
mkdir "var/$dir" unless -e "var/$dir";
open(my $fh, '>>', "var/$dir/$name") || die $!;
print $fh $value;
mkdir "var/$dir" unless -e "var/$dir";
open(my $fh, '>>', "var/$dir/$name") || die $!;
print $fh $value;
@@
-146,10
+147,11
@@
else {
my $saved;
$proxy->push_filter(
# you should probably restrict this to certain hosts as well
my $saved;
$proxy->push_filter(
# you should probably restrict this to certain hosts as well
- path => qr/\.pdf
$
/,
+ path => qr/\.pdf
\b
/,
mime => 'application/pdf',
# save the PDF
response => HTTP::Proxy::BodyFilter::save->new(
mime => 'application/pdf',
# save the PDF
response => HTTP::Proxy::BodyFilter::save->new(
+ timestamp => 1,
template => "%f",
prefix => 'pdf'
),
template => "%f",
prefix => 'pdf'
),
@@
-220,7
+222,7
@@
sub debug_dump { -e 'var/debug' && warn "## ", dump( @_ ) }
my $admin_filter = HTTP::Proxy::HeaderFilter::simple->new( sub {
my ( $self, $headers, $message ) = @_;
my $admin_filter = HTTP::Proxy::HeaderFilter::simple->new( sub {
my ( $self, $headers, $message ) = @_;
-warn "XXX [", $headers->header('x-forwarded-for'), '] ', $message->uri, "\n";
+warn "
\n
XXX [", $headers->header('x-forwarded-for'), '] ', $message->uri, "\n";
print $message->headers_as_string if debug_on;
print $message->headers_as_string if debug_on;
@@
-253,6
+255,9
@@
function FindProxyForURL(url, host) {
if (shExpMatch(url, "*.ico")) return "DIRECT";
if (shExpMatch(url, "*.jpg")) return "DIRECT";
if (shExpMatch(url, "*.ico")) return "DIRECT";
if (shExpMatch(url, "*.jpg")) return "DIRECT";
+ if (isInNet(host, "127.0.0.0", "255.0.0.0"))
+ return "DIRECT";
+
// if (isInNet(host, "10.0.0.0", "255.255.248.0")) {
// return "PROXY fastproxy.example.com:8080";
// }
// if (isInNet(host, "10.0.0.0", "255.255.248.0")) {
// return "PROXY fastproxy.example.com:8080";
// }