检查HTTP方法是否已被允许并在本地主机上启用

我在RHEL系统上运行Apache / 2.2.15(Unix)。 我的LAMP正在本地主机上运行。

我想检查一下HTTP方法:

  • POST,
  • 得到,
  • PUT和
  • 删除

被允许和启用。

我读过可以用netcattelnet进行检查https://www.owasp.org/index.php/Test_HTTP_Methods_(OTG-CONFIG-006)

(我对netcat和telnet都很陌生,所以对我也是如此)。当我尝试netcat时,这是我得到的:

[root@joseph ~]# nc localhost 80 OPTIONS / HTTP/1.1 HTTP/1.1 400 Bad Request Date: Fri, 15 Sep 2017 20:17:12 GMT Server: Apache/2.2.15 (Red Hat) Content-Length: 302 Connection: close Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title> </head><body> <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br /> </p> <hr> <address>Apache/2.2.15 (Red Hat) Server at 127.0.0.1 Port 80</address> </body></html> 

当我尝试telnet,这是我得到:

 [root@joseph ~]# telnet localhost 80 Trying ::1... Connected to localhost. Escape character is '^]'. OPTIONS / HTTP/1.0 Host localhost HTTP/1.1 400 Bad Request Date: Fri, 15 Sep 2017 19:48:30 GMT Server: Apache/2.2.15 (Red Hat) Content-Length: 302 Connection: close Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title> </head><body> <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br /> </p> <hr> <address>Apache/2.2.15 (Red Hat) Server at 127.0.0.1 Port 80</address> </body></html> Connection closed by foreign host. 

我明白,得到一个“400错误的请求”可能是由于格式错误https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

但是当我只是发送telnet或netcat命令时,怎么可能呢?

谢谢