ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/myhttpd/httpd.pl
(Generate patch)

Comparing Coro/myhttpd/httpd.pl (file contents):
Revision 1.41 by root, Mon Sep 10 22:16:20 2001 UTC vs.
Revision 1.42 by root, Wed Sep 12 16:45:59 2001 UTC

141 141
142read_mimetypes; 142read_mimetypes;
143 143
144sub new { 144sub new {
145 my $class = shift; 145 my $class = shift;
146 my $fh = shift;
146 my $peername = shift; 147 my $peername = shift;
147 my $fh = shift;
148 my $self = bless { fh => $fh }, $class; 148 my $self = bless { fh => $fh }, $class;
149 my (undef, $iaddr) = unpack_sockaddr_in $peername 149 my (undef, $iaddr) = unpack_sockaddr_in $peername
150 or $self->err(500, "unable to decode peername"); 150 or $self->err(500, "unable to decode peername");
151 151
152 $self->{remote_addr} = inet_ntoa $iaddr; 152 $self->{remote_addr} = inet_ntoa $iaddr;
179 179
180sub response { 180sub response {
181 my ($self, $code, $msg, $hdr, $content) = @_; 181 my ($self, $code, $msg, $hdr, $content) = @_;
182 my $res = "HTTP/1.1 $code $msg\015\012"; 182 my $res = "HTTP/1.1 $code $msg\015\012";
183 183
184 $self->{h}{connection} ||= $hdr->{Connection}; 184 $self->{h}{connection} = "close" if $hdr->{Connection} =~ /close/;
185 185
186 $res .= "Date: $HTTP_NOW\015\012"; 186 $res .= "Date: $HTTP_NOW\015\012";
187 187
188 while (my ($h, $v) = each %$hdr) { 188 while (my ($h, $v) = each %$hdr) {
189 $res .= "$h: $v\015\012" 189 $res .= "$h: $v\015\012"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines