1 | #!/usr/bin/perl |
1 | #!/usr/bin/perl |
|
|
2 | |
|
|
3 | # this is a relatively small web-server, using coroutines |
|
|
4 | # for connections. play around with it but do not use |
|
|
5 | # it in production. ask myhttpd@plan9.de for a better |
|
|
6 | # version that's more usable and bugfixed. |
2 | |
7 | |
3 | use Coro; |
8 | use Coro; |
4 | use Coro::Semaphore; |
9 | use Coro::Semaphore; |
5 | use Coro::Event; |
10 | use Coro::Event; |
6 | use Coro::Socket; |
11 | use Coro::Socket; |
… | |
… | |
227 | } |
232 | } |
228 | $port = $port == 80 ? "" : ":$port"; |
233 | $port = $port == 80 ? "" : ":$port"; |
229 | $host.$port; |
234 | $host.$port; |
230 | } |
235 | } |
231 | |
236 | |
|
|
237 | # no, this doesn't do cgi, but it's close enough |
|
|
238 | # for the no-longer-used directory indexing script. |
232 | sub _cgi { |
239 | sub _cgi { |
233 | my $self = shift; |
240 | my $self = shift; |
234 | my $path = shift; |
241 | my $path = shift; |
235 | my $fh; |
242 | my $fh; |
236 | |
243 | |