ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/tcp_http.ext
(Generate patch)

Comparing deliantra/server/ext/tcp_http.ext (file contents):
Revision 1.2 by root, Tue Nov 6 03:45:17 2012 UTC vs.
Revision 1.3 by root, Tue Nov 6 21:50:36 2012 UTC

56 56
57 $uri =~ s%^http://[^/]*%%i; # just in case 57 $uri =~ s%^http://[^/]*%%i; # just in case
58 58
59 cf::debug "HTTP GET: $self->{id} $uri"; 59 cf::debug "HTTP GET: $self->{id} $uri";
60 60
61 if ($uri =~ m%^/(M?)([0-9a-f]+)$%) { # faces 61 if ($uri =~ m%^/([0-9a-f]+)(M?)$%) { # faces
62 my $want_meta = $1; 62 my $want_meta = $1;
63 my $idx = $cf::FACEHASH{pack "H*", $2}; 63 my $idx = $cf::FACEHASH{pack "H*", $2};
64 64
65 $idx 65 $idx
66 or do { $self->respond ("404 illegal face name"), next }; 66 or do { $self->respond ("404 illegal face name"), next };
85 } else { 85 } else {
86 $self->respond ("200 OK", $data, (content_type $data) . $cache_headers); 86 $self->respond ("200 OK", $data, (content_type $data) . $cache_headers);
87 } 87 }
88 88
89 } elsif ($uri eq "/debug") { # for debugging 89 } elsif ($uri eq "/debug") { # for debugging
90 my $body = "<html><body>"; 90 my @body = "<html><body>";
91 91
92 for my $type (6, 5, 4, 3, 2, 1, 0) { 92 for my $type (6, 5, 4, 3, 2, 1, 0) {
93 $body .= "<h1>$type</h1>"; 93 push @body, "<h1>$type</h1>";
94 94
95 for (1 .. cf::face::faces_size - 1) { 95 for (1 .. cf::face::faces_size - 1) {
96 next if $type != cf::face::get_type $_; 96 next if $type != cf::face::get_type $_;
97 my $name = cf::face::get_name $_; 97 my $name = cf::face::get_name $_;
98 my $id = unpack "H*", cf::face::get_chksum $_, 1; 98 my $id = unpack "H*", cf::face::get_chksum $_, 1;
99 $body .= "$_ <a href='$id'>$name ($id)</a>"; 99 push @body, "$_ <a href='$id'>$name ($id)</a>";
100 $body .= " <a href='M$id'>(meta)</a>" if $type & 1; 100 push @body, " <a href='${id}M'>(meta)</a>" if $type & 1;
101 $body .= "<br>"; 101 push @body, "<br>";
102 } 102 }
103 } 103 }
104 104
105 $body .= "</body></html>"; 105 push @body, "</body></html>";
106 106
107 $self->respond ("200 OK", $body, "Content-Type: text/html\015\012"); 107 $self->respond ("200 OK", (join "", @body), "Content-Type: text/html\015\012");
108 } elsif ($uri eq "/ws" && defined &ext::ws::server) { 108 } elsif ($uri eq "/ws" && defined &ext::ws::server) {
109 &ext::ws::server ($self->{id}, $self->{fh}, "$req\015\012\015\012$self->{rbuf}"); 109 &ext::ws::server ($self->{id}, $self->{fh}, "$req\015\012\015\012$self->{rbuf}");
110 110
111 %$self = (); 111 %$self = ();
112 112

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines