Commit 2c905fd1 authored by Jonas Schnelli's avatar Jonas Schnelli Committed by Daniel Stenberg
Browse files

query-part: ignore the URI part for given protocols

By setting PROTOPT_NOURLQUERY in the protocol handler struct, the
protocol will get the "query part" of the URL cut off before the data is
handled by the protocol-specific code. This makes libcurl adhere to
RFC3986 section 2.2.

Test 1220 is added to verify a file:// URL with query-part.
parent 4403e82f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ const struct Curl_handler Curl_handler_dict = {
  ZERO_NULL,                            /* readwrite */
  PORT_DICT,                            /* defport */
  CURLPROTO_DICT,                       /* protocol */
  PROTOPT_NONE                          /* flags */
  PROTOPT_NONE | PROTOPT_NOURLQUERY      /* flags */
};

static char *unescape_word(struct SessionHandle *data, const char *inputbuff)
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ const struct Curl_handler Curl_handler_file = {
  ZERO_NULL,                            /* readwrite */
  0,                                    /* defport */
  CURLPROTO_FILE,                       /* protocol */
  PROTOPT_NONETWORK                     /* flags */
  PROTOPT_NONETWORK | PROTOPT_NOURLQUERY /* flags */
};


+3 −2
Original line number Diff line number Diff line
@@ -178,7 +178,8 @@ const struct Curl_handler Curl_handler_ftp = {
  ZERO_NULL,                       /* readwrite */
  PORT_FTP,                        /* defport */
  CURLPROTO_FTP,                   /* protocol */
  PROTOPT_DUAL | PROTOPT_CLOSEACTION | PROTOPT_NEEDSPWD /* flags */
  PROTOPT_DUAL | PROTOPT_CLOSEACTION | PROTOPT_NEEDSPWD
  | PROTOPT_NOURLQUERY /* flags */
};


@@ -205,7 +206,7 @@ const struct Curl_handler Curl_handler_ftps = {
  PORT_FTPS,                       /* defport */
  CURLPROTO_FTP | CURLPROTO_FTPS,  /* protocol */
  PROTOPT_SSL | PROTOPT_DUAL | PROTOPT_CLOSEACTION |
  PROTOPT_NEEDSPWD /* flags */
  PROTOPT_NEEDSPWD | PROTOPT_NOURLQUERY /* flags */
};
#endif

+4 −2
Original line number Diff line number Diff line
@@ -125,7 +125,8 @@ const struct Curl_handler Curl_handler_imap = {
  ZERO_NULL,                        /* readwrite */
  PORT_IMAP,                        /* defport */
  CURLPROTO_IMAP,                   /* protocol */
  PROTOPT_CLOSEACTION | PROTOPT_NEEDSPWD /* flags */
  PROTOPT_CLOSEACTION | PROTOPT_NEEDSPWD
  | PROTOPT_NOURLQUERY              /* flags */
};


@@ -151,7 +152,8 @@ const struct Curl_handler Curl_handler_imaps = {
  ZERO_NULL,                        /* readwrite */
  PORT_IMAPS,                       /* defport */
  CURLPROTO_IMAP | CURLPROTO_IMAPS, /* protocol */
  PROTOPT_CLOSEACTION | PROTOPT_SSL | PROTOPT_NEEDSPWD /* flags */
  PROTOPT_CLOSEACTION | PROTOPT_SSL | PROTOPT_NEEDSPWD
  | PROTOPT_NOURLQUERY              /* flags */
};
#endif

+3 −2
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ const struct Curl_handler Curl_handler_pop3 = {
  ZERO_NULL,                        /* readwrite */
  PORT_POP3,                        /* defport */
  CURLPROTO_POP3,                   /* protocol */
  PROTOPT_CLOSEACTION               /* flags */
  PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY /* flags */
};


@@ -151,7 +151,8 @@ const struct Curl_handler Curl_handler_pop3s = {
  ZERO_NULL,                        /* readwrite */
  PORT_POP3S,                       /* defport */
  CURLPROTO_POP3 | CURLPROTO_POP3S, /* protocol */
  PROTOPT_CLOSEACTION | PROTOPT_SSL /* flags */
  PROTOPT_CLOSEACTION | PROTOPT_SSL
  | PROTOPT_NOURLQUERY              /* flags */
};
#endif

Loading