【发布时间】:2016-04-24 22:02:54
【问题描述】:
我目前在我的本地机器上运行 Apache Tomcat。
当我尝试使用 telnet 时:
telnet localhost 8080
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /beer/
我会收到类似如下的回复:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Beer Expert!</title>
<meta charset="utf-8">
</head>
<body>
等等等等。
我的第一个问题是:所有的 HTTP 响应标头,例如 HTTP/1.1 200 OK 等在哪里?
当我按如下方式尝试我的 telnet 查询时:
telnet localhost 8080
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /beer/ HTTP/1.1
我会得到:
HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
Date: Tue, 19 Jan 2016 12:15:23 GMT
Connection: close
0
Connection closed by foreign host.
为什么我现在会看到 HTTP 响应标头?为什么我会收到 Bad Request 响应?
【问题讨论】: