--- deliantra/server/ext/tcp_http.ext 2012/11/11 06:34:27 1.13 +++ deliantra/server/ext/tcp_http.ext 2012/11/12 01:06:38 1.14 @@ -1,6 +1,6 @@ #! perl # optional depends=tcp -# http server - this tried to speak enough of http 1.1 (and 1.0) +# http server - this tries to speak enough of http 1.1 (and 1.0) # to work with browsers. it does not even attempt to be a complete # implementation, although it should be mostly correct for that it does. @@ -73,22 +73,24 @@ $uri =~ s%^http://[^/]*%%i; # just in case $uri =~ s/%([0-9a-fA-F][0-9a-fA-F])/chr hex $1/ge; # %-decode -# my %hdr; -# -# $hdr{lc $1} .= ",$2" -# while $req =~ /\G -# ([^:\000-\037]*): -# [\011\040]* -# ((?: [^\012]+ | \012[\011\040] )*) -# \012 -# /gxc; -# -# $req =~ /\G$/ -# or return $self->respond ("400 bad request"); -# -# # remove the "," prefix we added to all headers above -# substr $_, 0, 1, "" -# for values %hdr; + if (0) { + my %hdr; + + $hdr{lc $1} .= ",$2" + while $req =~ /\G + ([^:\000-\037]*): + [\011\040]* + ((?: [^\012]+ | \012[\011\040] )*) + \012 + /gxc; + + $req =~ /\G$/ + or return $self->respond ("400 bad request"); + + # remove the "," prefix we added to all headers above + substr $_, 0, 1, "" + for values %hdr; + } if ($http == 1.0) { if ($req =~ /^connection\s*:\s*keep-alive/mi) { @@ -150,8 +152,20 @@ $self->respond ("302 dirslash", "", "location: $uri/\015\012"); } elsif ($uri eq "/debug") { # for debugging - my @body = ""; - + my @body = < +EOF for my $type (6, 5, 4, 3, 2, 1, 0) { push @body, "

$type

";
#csumsizenamemeta