Changeset 62 for trunk/uribl/uridb.cgi


Ignore:
Timestamp:
02/12/16 15:45:59 (9 years ago)
Author:
Kris Deugau
Message:

/trunk/uribl

Commit accumulated tweaks and fixes from production:

  • add "use Encode;" and set the HTTP charset header to deal with non-ASCII more sanely
  • reorder mangling of request-URI components a little so we can symlink index.cgi -> uridb.cgi
  • collapse results from extract-data showing a hit on some other DNSBL into a single field rather than just treating it as "another domain" that needs to be hand-reflagged as "don't list"
  • use POST for form submissions; mainly to clean up the working URL
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/uribl/uridb.cgi

    r41 r62  
    2525use CGI::Simple;
    2626use HTML::Template;
     27use Encode;
     28
    2729use URIdb;
    2830
     
    4042my $uridb = new URIdb;
    4143
    42 print "Content-type: text/html\n\n";
     44print $q->header(-charset=>'utf8');
    4345
    4446# default DB info - all other settings should be loaded from the DB.
     
    7173
    7274my $page;
    73 my $templatedir = $ENV{SCRIPT_FILENAME};
    74 $templatedir =~ s/uridb\.cgi//;
    75 $templatedir .= "templates";
    76 $ENV{HTML_TEMPLATE_ROOT} = $templatedir;
    7775
    7876my $cgiself = $ENV{SCRIPT_FILENAME};
    7977$cgiself =~ s|.+/([^/]+\.cgi)$|$1|;
     78
     79my $templatedir = $ENV{SCRIPT_FILENAME};
     80$templatedir =~ s/$cgiself//;
     81$templatedir .= "templates";
     82$ENV{HTML_TEMPLATE_ROOT} = $templatedir;
    8083
    8184my %config;
     
    98101
    99102my $uridbsiteroot = $ENV{REQUEST_URI};
    100 $uridbsiteroot =~ s|/uridb\.cgi\?.+|/|;
     103$uridbsiteroot =~ s|/$cgiself\?.+|/|;
    101104$page->param(uridbsiteroot => $uridbsiteroot);
    102105
     
    108111  foreach my $domain (@dombase) {
    109112    my %row;
    110     $row{domindex} = $domcount++;
    111113    ($domain) = split /:/, $domain;
    112114    $domain =~ s/^\+//;
    113115    $domain =~ s/\.uribl.company.com//;
    114116    chomp $domain;
     117    # now, see if it's multilisted
     118    if ($domain =~ / on (\w+)\s*$/) {
     119      my $sub = $1;
     120      #$domain =~ s/ on \w+\s*$//;
     121      $domlist[$domcount-1]->{otherlists} .= ",$sub";
     122      next;
     123    }
     124    $row{domindex} = $domcount++;
    115125    $row{domain} = $domain;
    116126    push @domlist, \%row;
    117127  }
     128
    118129  $page->param(domlist => \@domlist);
    119130
Note: See TracChangeset for help on using the changeset viewer.