/[meteor]/googlecode.com/svn/trunk/Meteor/Document.pm
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 /googlecode.com/svn/trunk/Meteor/Document.pm

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

revision 25 by knops.gerd, Sun May 20 19:40:53 2007 UTC revision 38 by knops.gerd, Fri Feb 1 21:54:05 2008 UTC
# Line 53  sub serveFileToClient { Line 53  sub serveFileToClient {
53          unless(defined($doc))          unless(defined($doc))
54          {          {
55                  $class->emitHeaderToClient($client,'404 Not Found');                  $class->emitHeaderToClient($client,'404 Not Found');
56                    $::Statistics->{'documents_not_found'}++;
57                                    
58                  return undef;                  return undef;
59          }          }
# Line 68  sub emitHeaderToClient { Line 69  sub emitHeaderToClient {
69          my $self=shift;          my $self=shift;
70          my $client=shift;          my $client=shift;
71          my $status=shift;          my $status=shift;
72            my $length=shift;
73            my $contenttype=shift;
74            $length = 0 unless ($length);
75            $contenttype = "text/html" unless ($contenttype);
76                    
77          my $header=$::CONF{'DocumentHeaderTemplate'};          my $header="HTTP/1.1 ".$status."\r\nServer: ".$::PGM."\r\nContent-Type: ".$contenttype."; charset=utf-8\r\nPragma: no-cache\r\nCache-Control: no-cache, no-store, must-revalidate\r\nExpires: Thu, 1 Jan 1970 00:00:00 GMT\r\nContent-length: ".$length."\r\n\r\n";
           
         $header=~s/~([^~]+)~/  
                 if(!defined($1) || $1 eq '')  
                 {  
                         '~';  
                 }  
                 elsif($1 eq 'server')  
                 {  
                         $::PGM;  
                 }  
                 elsif($1 eq 'status')  
                 {  
                         $status;  
                 }  
                 else  
                 {  
                         '';  
                 }  
         /gex;  
78                    
79          $client->write($header);          $client->write($header);
80  }  }
# Line 248  sub newDocument { Line 234  sub newDocument {
234  sub serveTo {  sub serveTo {
235          my $self=shift;          my $self=shift;
236          my $client=shift;          my $client=shift;
237            my $ct = "text/html";
238            if ($self->{'path'} =~/\.(js)$/) {
239                    $ct = "text/javascript";
240            }
241                    
242          $self->emitHeaderToClient($client,'200 OK');          $self->emitHeaderToClient($client,'200 OK',$self->{'size'}, $ct);
243                    
244          $client->write($self->{'document'});          $client->write($self->{'document'});
245    
246  }  }
247    
248  sub path {  sub path {

Legend:
Removed from v.25  
changed lines
  Added in v.38

  ViewVC Help
Powered by ViewVC 1.1.26