cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: OPTIONS * requests

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 25 Aug 2016 23:46:52 +0200 (CEST)

On Thu, 25 Aug 2016, Nicholas Shanks wrote:

> As someone without legacy code, doing
> $ curl -X OPTIONS http://www.example.com
> Would be my preferred choice, but I can easily see that existing code would
> expect that to be equal to
> $ curl -X OPTIONS http://www.example.com/

It's not about legacy really, it is about what curl knows and does.

Currently the existing code will always add a slash if there isn't one so the
two lines above will end up the same internally.

Then, curl doesn't know OPTIONS *at all* so in this case it would send
"OPTIONS /" because we asked to send OPTIONS and the slash is derived from the
path part.

How would curl decide that the slash would suddenly be an asterisk? And what
if you really wanted to do OPTIONS / ? And what if you want to be able to also
do "ONIONS *".

I'd like to avoid "hard-coding" curl to know that "*" is magic for OPTION. I
prefer making it possible to send it without curl knowing its special.

Something like

   curl -X OPTIONS http://example.com/* --strip-slash

One downside with this solution is that if you'd ask that to be used over a
proxy, you'd have to change the URL to make curl send the right thing. But I
think that's ine line with what curl does, it lets the user provide the URL
and curl just passes it on.

Tricky!

> How does curl format request lines with the host present?

The host is present in the request line when sent to a proxy, like Tatsuhiro
showed.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-08-25