我有當前在本地機器上運行的Apache Tomcat。當我使用HTTP協議嘗試我的請求時,爲什麼會收到錯誤的請求響應?
當我嘗試這樣通過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確定等?
此外,當我盡我的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響應頭?爲什麼我會收到錯誤請求的迴應?