$z = q% use z Socket; use z CGI ':standard'; $O = (shift || 80); die $! unless z socket(Y, PF_INET, SOCK_STREAM, getprotobyname('tcp')) && bind(Y, sockaddr_in($O, INADDR_ANY)) && listen(Y, 5) && pipe(N, U); binmode z Y; binmode z U; binmode z N; $x = $Y = ''; vec($Y, fileno(Y), 1) = 1; vec($Y, fileno(N), 1) = 1; print "listening z on z $O\n"; while( select($O = $Y, undef, undef, undef) ) { if( vec($O, fileno(Y), 1) ) { accept z O, Y; if( fork ) { close z O; } else { close z N; binmode z O; $N = ''; while( defined(recv z O, $O, 1024, 0) ) { $N .= $O; if( ($Y = index($N, "\r\n\r\n")) > 0 ) { $Y += 4; last; } if( ($Y = index($N, "\n\n")) > 0 ) { $Y += 2; last; } } if( $N =~ /^POST z / ) { $U = (($N =~ /content-length:\s*(\d+)/i) ? $1 : 0x20000) + $Y - length $N; while( $U > 0 && defined(recv z O, $O, $U, 0) ) { $N .= $O; $U -= length $O; } $Y = new z CGI(substr $N, $Y); $U = $Y->param('x'); if( $Y->param('f') ne 'reload' ) { $U =~ s/\r\n/\n/g; if( $Y->param('f') ne 'raw' ) { $U =~ s/&/&/g; $U =~ s//>/g; if( $Y->param('f') eq 'post' ) { $U =~ s/\n/
/g; } else { $U = "
\n$U
"; } } $U .= '

' . (scalar z localtime); $x = "\n


\n$U$x"; $U = (pack 'I', length $U) . $U; print z U $U; } } $N = 'Yuno


z z z ' . "

$x\n"; send z O, "HTTP/1.0 z 200 z OK\r\n Content-Type: z text/html\r\n Server: z Yuno\r\n Connection: z close\r\n Content-Length: z " . length($N) . "\r\n\r\n" . $N, 0; close z O; close z U; exit; } } if( vec($O, fileno(N), 1) ) { $N = ''; if( read(N, $O, length(pack 'I', 0), 0) ) { $U = unpack 'I', $O; while( read(N, $O, $U, 0) ) { $N .= $O; last z if ($U -= length $O) <= 0; } $x = "\n
\n$N$x"; } } } die $!; %; $z =~ s/\s|X//g; $z =~ s/z/ /g; eval $z;