- 论坛徽章:
- 0
|
如何让perl直接接管http请求,比如访问:http://host:88/test.pl,- #!/usr/bin/perl -w
- use Encode qw/encode decode/;
- my $Line;
- $Line = "";
- $| = 1;
- binmode(STDIN);
- print "Content-type: text/html\r\n\r\n";
- while (read (STDIN ,$Line, 1024)) {
- print $Line;
- }
复制代码 输出:- GET /test.pl HTTP/1.1
- Accept: */*
- Accept-Language: zh-CN
- User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C)
- Accept-Encoding: gzip, deflate
- Host: host:88
- Connection: Keep-Alive
- Cache-Control: no-cache
复制代码 |
|