/[mws]/trunk/httpd.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/httpd.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by dpavlin, Mon May 10 20:26:17 2004 UTC revision 47 by dpavlin, Tue May 11 22:59:27 2004 UTC
# Line 3  Line 3 
3  # based on post  # based on post
4  # http://www.mail-archive.com/libwww@perl.org/msg04750.html  # http://www.mail-archive.com/libwww@perl.org/msg04750.html
5    
6    BEGIN {
7            my $basedir = readlink($0) || $0; $basedir =~ s#/[^/]+$##;
8            unshift(@INC, $basedir);
9    }
10    
11    =head1 NAME
12    
13    httpd.pl - http server for Mail::Box Web Search
14    
15    =head1 SYNOPSYS
16    
17     httpd.pl [local.conf]
18    
19    =head1 DESCRIPTION
20    
21    This is small http server, based on C<HTTP::Daemon> which is designed
22    for single-user use (on laptop for example) via loopback.
23    
24    It doesn't provide any authentification or authorisation, and it can handle
25    just one request at the time, so it's not suted for public-facing sites,
26    even if you don't care about security of your mailboxes.
27    
28    =head1 SEE ALSO
29    
30    C<MWS> perl modules which are part of this package
31    
32    =cut
33    
34  use strict;  use strict;
35  use warnings;  use warnings;
36  use MWS::SWISH;  use MWS::SWISH;
# Line 106  while ( my $c = $d->accept ) { Line 134  while ( my $c = $d->accept ) {
134    
135                  # XXX LOG                  # XXX LOG
136                  print $r->method," ",$url,"\n";                  print $r->method," ",$url,"\n";
137                  print Dumper($param),"\n" if ($debug);                  print Dumper($param,$mws->{counter}),"\n" if ($debug);
138    
139                  # is this static page?                  # is this static page?
140                  if ($static_html && -f "$static_html/$url") {                  if ($static_html && -f "$static_html/$url") {
# Line 203  while ( my $c = $d->accept ) { Line 231  while ( my $c = $d->accept ) {
231    
232    
233                  # push counters to template                  # push counters to template
234                  foreach my $f (qw(from to cc bcc)) {                  foreach my $f (qw(from to cc bcc folder)) {
235                          my $h = $mws->counter($f) || next;                          my $h = $mws->counter($f) || next;
236                          my @a;                          my @a;
237                          foreach my $k (sort { $h->{$b}->{usage} <=> $h->{$a}->{usage} } keys %$h) {                          foreach my $k (sort { $h->{$b}->{usage} <=> $h->{$a}->{usage} } keys %$h) {
# Line 266  sub body5_filter { Line 294  sub body5_filter {
294          $text =~ s/(\s*--+\s*Forwarded\s+message.+\s*--+.*)$//si;          $text =~ s/(\s*--+\s*Forwarded\s+message.+\s*--+.*)$//si;
295    
296          # remove signature          # remove signature
297          $text =~ s/[\n\r]+--\s*[\n\r]+.*$//s;          $text =~ s/(?:^|[\n\r]+)*--\s*[\n\r]+.*$//s;
298            $text =~ s/(?:^|[\n\r]+)*_____+[\n\r]+.*$//s;
299    
300          # compress cr/lf          # compress cr/lf
301          $text =~ s/[\n\r]+/\n/gs;          $text =~ s/[\n\r]+/\n/gs;
# Line 298  sub body_filter { Line 327  sub body_filter {
327          # remove signature          # remove signature
328          if ($text =~ s/([\n\r]+)(--\s*[\n\r]+.*)$//s) {          if ($text =~ s/([\n\r]+)(--\s*[\n\r]+.*)$//s) {
329                  $sig = "$1#-#signature##$2##signature#-#";                  $sig = "$1#-#signature##$2##signature#-#";
330            } elsif ($text =~s/(^|[\n\r]+)*(_____+[\n\r]+.*)$//s) {
331                    $sig = "$1#-#signature##$2##signature#-#";
332          }          }
333    
334          # find quoted text          # find quoted text

Legend:
Removed from v.41  
changed lines
  Added in v.47

  ViewVC Help
Powered by ViewVC 1.1.26