我有一个在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>
这是什么错误?
答案 0 :(得分:1)
尝试curl
使用-i
来显示回复标题:
curl -i -X OPTIONS http://10.0.0.3/
如果重定向,请同时指定-L
:
curl -i -X OPTIONS -L http://10.0.0.3/
您最终会看到一些包含Allow
标头的响应标头;例如:
Allow: OPTIONS,GET,HEAD,POST
如果您真的想使用nc
,可以这样做:
$ nc 10.0.0.3 80
OPTIONS / HTTP/1.1
Host: 10.0.0.3
问题中的调用与此有何不同:
HTTP/1.1
附加到OPTIONS
命令(就像您必须使用GET
,HEAD
等一样。)Host: <hostname>
命令OPTIONS
行