our @blockuri; our @blockref; sub read_blockuri { local *B; my %group; @blockuri = (); if (open B, ") { chomp; if (/^group\s+(\S+)\s+(.*)/i) { $group{$1} = [split /\s+/, $2]; } elsif (/^!([^\t]*)\t\s*(.*)/) { my $g = $1; my @r; for (split /\s+/, $2) { push @r, $group{$_} ? @{$group{$_}} : $_; } print "not($g) => (@r)\n"; push @blockuri, [qr/$g/i, \@r]; } elsif (/\S/) { print "blockuri: unparsable line: $_\n"; } } } else { print "no blockuri\n"; } } sub read_blockref { local *B; @blockref = (); if (open B, ") { chomp; if (/^([^\t]*)\t\s*(.*)/) { push @blockref, qr/^$1/i; } elsif (/\S/) { print "blockref: unparsable line: $_\n"; } } } else { print "no blockref\n"; } } read_blockuri; read_blockref; use Tie::Cache; tie %whois_cache, Tie::Cache::, $MAX_CONNECTS * 1.5; sub conn::err_block_country { my $self = shift; my $whois = shift; $whois =~ s/&/&/g; $whois =~ s/err(403, "forbidden", { "Content-Type" => "text/html" }, < This material is licensed in your country!

This material is licensed in your country!

My research has shown that your IP address ($self->{remote_addr}) most probably is located in this country: $self->{country} (ISO-3166-2 code, XX == unknown). The full record is:

$whois

My database says that the material you are trying to access is licensed in your country. If I would distribute these files to your country I would actively hurt the industry behind it, which includes the artists and authors of these videos/mangas. So I hope you understand that I try to avoid this.

If you really think that this is wrong, i.e. the material you tried to access is not licensed in your country or your ip address was misdetected, you can write to licensed\@plan9.de. Please explain what happened and why you think this is wrong in as much detail as possible.

Thanks a lot for understanding.
EOF } sub conn::err_block_referer { my $self = shift; my $uri = $self->{uri}; $uri =~ s/\/[^\/]+$/\//; $uri = escape_uri $uri; print "hiho $uri\n";#d# $self->slog(6, "REFERER($self->{uri},$self->{h}{referer})"); $whois =~ s/&/&/g; $whois =~ s/err(203, "non-authoritative", { "Content-Type" => "text/html" }, < Unallowed Referral

The site which referred you has done something bad!

It seems that you are coming from this URL:

$self->{h}{referer}

This site has been blocked, either because it required you to pay money, forced you to click on banners, claimed these files were theirs or something very similar. Please note that you can download these files without having to pay, without clicking banners or jump through other hoops.

Sites like the one you came from actively hurt the distribution of these files and the service quality for you since I can't move or correct files and you will likely not be able to see the full archive.

Having that this, you can find the original content (if it is still there) by following this link.

Thanks a lot for understanding.
EOF } sub conn::access_check { my $self = shift; my $ref = $self->{h}{referer}; my $uri = $self->{path}; my %disallow; for (@blockref) { $self->err_block_referer if $ref =~ $_; } for (@blockuri) { if ($uri =~ $_->[0]) { $disallow{$_}++ for @{$_->[1]}; } } my $whois = $whois_cache{$self->{remote_addr}} ||= ::ip_request($self->{remote_addr}); my $country = "XX"; if ($whois =~ /^\*cy: (\S+)/m) { $country = uc $1; } else { $self->slog(9, "no country($whois)"); } $self->{country} = $country; if ($disallow{$country}) { $self->err_block_country($whois); } } 1;