urlapi: add CURLU_NO_GUESS_SCHEME

Used for extracting:

- when used asking for a scheme, it will return CURLUE_NO_SCHEME if the
  stored information was a guess

- when used asking for a URL, the URL is returned without a scheme, like
  when previously given to the URL parser when it was asked to guess

- as soon as the scheme is set explicitly, it is no longer internally
  marked as guessed

The idea being:

1. allow a user to figure out if a URL's scheme was set as a result of
  guessing

2. extract the URL without a guessed scheme

3. this makes it work similar to how we already deal with port numbers

Extend test 1560 to verify.

Closes #13616
This commit is contained in:
Daniel Stenberg 2024-06-01 12:03:34 +02:00
parent 80aa519545
commit 655d44d139
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 38 additions and 2 deletions

View file

@ -102,6 +102,7 @@ typedef enum {
#define CURLU_GET_EMPTY (1<<14) /* allow empty queries and fragments
when extracting the URL or the
components */
#define CURLU_NO_GUESS_SCHEME (1<<14) /* for get, don't accept a guess */
typedef struct Curl_URL CURLU;