是否可以发送“OPTIONS *”。用cURL? [英] Is it possible to send "OPTIONS *" with cURL?

查看:1068
本文介绍了是否可以发送“OPTIONS *”。用cURL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RFC7230超文本传输​​协议(HTTP / 1.1):消息语法和路由


当客户端希望为服务器作为一个整体而不是该服务器的特定命名资源请求OPTIONS时,客户端必须只发送*(%x2A)作为请求目标。


要测试我的网站反应,发送以下请求到服务器。

  OPTIONS * HTTP / 1.1 
pre>

我知道我可以使用telnet,写我自己的客户端等
但是我想知道是否可以使用cURL? p>

编辑
这不能通过 curl -X OPTIONS http://example.org ,如 a类似但不完全相同的问题该命令将发送 OPTIONS http://example.org/ HTTP / 1.1 。我想知道是否可以用cURL发送星号。

解决方案



我真的不认为这是可能的(也就是使用 -X OPTIONS 等)将发送一个斜线,而不是一个星号),虽然我当然会非常开放,使有可能在未来的版本,如果有人想加入,并帮助我们解决这种疏忽。


From RFC7230 Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing

When a client wishes to request OPTIONS for the server as a whole, as opposed to a specific named resource of that server, the client must send only "*" (%x2A) as the request-target.

To test how my site reacts I want to send the following request to the server.

OPTIONS * HTTP/1.1

I know I can use telnet, write my own client, etc. But I want to know if it's possible to do it with cURL?

Edit This can NOT be done with curl -X OPTIONS http://example.org, as suggested in a similar, but not identical, question That command will send OPTIONS http://example.org/ HTTP/1.1. I want to know if it's possible to send the asterisk with cURL.

解决方案

(speaking as the main curl developer)

I honestly don't think it is possible (that is, using -X OPTIONS etc will send a slash and not an asterisk), although I would of course be very open to making it possible in a future version in case someone wants to join in and help us fix this oversight.

这篇关于是否可以发送“OPTIONS *”。用cURL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆