您如何找到网络服务器支持的所有 HTTP 方法的列表?
How do you find the list of all the supported HTTP methods by a webserver?
我在 10.0.0.3 上有一个 apache 服务器 运行,我如何使用 nc 获取支持的 http 方法列表?
我试过这个..没有成功。
nc 10.0.0.3 80
OPTIONS /
响应是 500 服务器错误..
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
webmaster@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at 127.0.1.1 Port 80</address>
</body></html>
这有什么错误吗?
尝试使用 curl
使用 -i
显示响应 header,并使用 -L
跟随任何重定向:
curl -i -L -X OPTIONS http://10.0.0.3/
您会看到一些包含 Allow
header 的回复 header;示例:
Allow: OPTIONS,GET,HEAD,POST
如果你真的想改用 nc
,你可以这样做:
$ nc 10.0.0.3 80
OPTIONS / HTTP/1.1
Host: 10.0.0.3
这与问题中的 nc
调用的不同之处在于:
- 将
HTTP/1.1
附加到 OPTIONS
行(就像您必须使用 GET
、HEAD
等一样)
- 在
OPTIONS
行后添加 Host: <hostname>
行
我在 10.0.0.3 上有一个 apache 服务器 运行,我如何使用 nc 获取支持的 http 方法列表? 我试过这个..没有成功。
nc 10.0.0.3 80
OPTIONS /
响应是 500 服务器错误..
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
webmaster@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at 127.0.1.1 Port 80</address>
</body></html>
这有什么错误吗?
尝试使用 curl
使用 -i
显示响应 header,并使用 -L
跟随任何重定向:
curl -i -L -X OPTIONS http://10.0.0.3/
您会看到一些包含 Allow
header 的回复 header;示例:
Allow: OPTIONS,GET,HEAD,POST
如果你真的想改用 nc
,你可以这样做:
$ nc 10.0.0.3 80
OPTIONS / HTTP/1.1
Host: 10.0.0.3
这与问题中的 nc
调用的不同之处在于:
- 将
HTTP/1.1
附加到OPTIONS
行(就像您必须使用GET
、HEAD
等一样) - 在
OPTIONS
行后添加Host: <hostname>
行