10

这是我尝试过的

telnet www.google.com 80

Get   HTTP/1.1  Host:www.google.com 

这是我收到的

HTTP/1.0 400 Bad Request
Content-Type: text/html; charset=UTF-8
Content-Length: 925
Date: Sat, 24 Nov 2012 19:37:42 GMT
Server: GFE/2.0

我该如何进行这项工作?我尝试使用 telnet 访问 www.google.com

4

2 回答 2

14
$ telnet www.google.com 80
Trying 173.194.38.82...
Connected to www.google.com.
Escape character is '^]'.
GET / HTTP/1.1

HTTP/1.1 302 Found
Location: http://www.google.co.jp/
Cache-Control: private
Content-Type: text/html; charset=UTF-8
[.... skipped ....]
于 2012-11-24T19:43:08.490 回答
6

发出请求后:

GET / HTTP/1.1

您还需要输入一个空行以表明您的请求已结束,否则将不会返回任何内容。

参考: http: //blog.nullspace.io/day-208.html

于 2016-02-27T02:53:24.120 回答