cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: OPTIONS * requests

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 26 Aug 2016 23:33:36 +0200 (CEST)

On Fri, 26 Aug 2016, Nicholas Shanks wrote:

>> 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.
>
> That's what I mean about legacy users. I'd rather curl didn't add a slash
> internally, and kept the path as an empty string.

Ok, but that's completely ruled out.

People enter URLs like that everywhere and they "just work", so they have to
work in curl too. And they have worked like that since day 1.

> At the moment when you realise you're not sending the request to a proxy and
> the full path has been built but is still empty (and thus are about to emit
> "GET HTTP/1.1") do you substitute an asterisk.

But then "curl example.com" would send a "GET * HTTP/1.1", that most likely
gets a 400 back or something like that. Not totally useful nor expected.
It simply is not a way forward.

>> curl -X OPTIONS http://example.com/* --strip-slash
>
> Such a --strip-slash option leaks details of how curl internally does
> things, and isn't intuitive IMHO.

I agree that it presumes knowledge about how a http client converts a URL to a
path in the request and that certainly is not universal knowledge. But then
neither is "OPTION *" ...

A possibly somewhat brutal approach would be a separate option to totally
override the path sent in the request line of the request:

   curl -X OPTIONS http://example.com/ --request-path "*"

That will unfortunately again require a different string if a proxy is used.
And still assume quite a lot of knowledge of the protocol.

Darnit, maybe a dedicated --options-server flag is the only way we can do this
that doesn't imply intimate knowledge of the protocol and that can be made to
work transparantly with and without the use of a proxy. It would send a
"OPTIONS * HTTP/1.1" or "OPTIONS http://example.com HTTP/1.1".

-- 
  / 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-26