diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dict.c | 2 | ||||
-rw-r--r-- | lib/file.c | 2 | ||||
-rw-r--r-- | lib/ftp.c | 5 | ||||
-rw-r--r-- | lib/imap.c | 6 | ||||
-rw-r--r-- | lib/pop3.c | 5 | ||||
-rw-r--r-- | lib/smtp.c | 5 | ||||
-rw-r--r-- | lib/ssh.c | 6 | ||||
-rw-r--r-- | lib/telnet.c | 2 | ||||
-rw-r--r-- | lib/tftp.c | 2 | ||||
-rw-r--r-- | lib/url.c | 19 | ||||
-rw-r--r-- | lib/urldata.h | 2 |
11 files changed, 42 insertions, 14 deletions
diff --git a/lib/dict.c b/lib/dict.c index b326054d1..0fad32bfa 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -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) diff --git a/lib/file.c b/lib/file.c index 9421c445b..4447c73f6 100644 --- a/lib/file.c +++ b/lib/file.c @@ -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 */ }; @@ -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 diff --git a/lib/imap.c b/lib/imap.c index ab53c9d74..c98730cb5 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -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 diff --git a/lib/pop3.c b/lib/pop3.c index 6cda3bc5a..8fd8ab01f 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -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 diff --git a/lib/smtp.c b/lib/smtp.c index ea6bafaf8..7512f1d0a 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -133,7 +133,7 @@ const struct Curl_handler Curl_handler_smtp = { ZERO_NULL, /* readwrite */ PORT_SMTP, /* defport */ CURLPROTO_SMTP, /* protocol */ - PROTOPT_CLOSEACTION /* flags */ + PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY /* flags */ }; #ifdef USE_SSL @@ -158,7 +158,8 @@ const struct Curl_handler Curl_handler_smtps = { ZERO_NULL, /* readwrite */ PORT_SMTPS, /* defport */ CURLPROTO_SMTP | CURLPROTO_SMTPS, /* protocol */ - PROTOPT_CLOSEACTION | PROTOPT_SSL /* flags */ + PROTOPT_CLOSEACTION | PROTOPT_SSL + | PROTOPT_NOURLQUERY /* flags */ }; #endif @@ -171,7 +171,8 @@ const struct Curl_handler Curl_handler_scp = { ZERO_NULL, /* readwrite */ PORT_SSH, /* defport */ CURLPROTO_SCP, /* protocol */ - PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION /* flags */ + PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION + | PROTOPT_NOURLQUERY /* flags */ }; @@ -196,7 +197,8 @@ const struct Curl_handler Curl_handler_sftp = { ZERO_NULL, /* readwrite */ PORT_SSH, /* defport */ CURLPROTO_SFTP, /* protocol */ - PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION /* flags */ + PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION + | PROTOPT_NOURLQUERY /* flags */ }; diff --git a/lib/telnet.c b/lib/telnet.c index 59094b674..bbad08de1 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -188,7 +188,7 @@ const struct Curl_handler Curl_handler_telnet = { ZERO_NULL, /* readwrite */ PORT_TELNET, /* defport */ CURLPROTO_TELNET, /* protocol */ - PROTOPT_NONE /* flags */ + PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */ }; diff --git a/lib/tftp.c b/lib/tftp.c index 9b44a9b3d..370665a43 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -190,7 +190,7 @@ const struct Curl_handler Curl_handler_tftp = { ZERO_NULL, /* readwrite */ PORT_TFTP, /* defport */ CURLPROTO_TFTP, /* protocol */ - PROTOPT_NONE /* flags */ + PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */ }; /********************************************************** @@ -4824,6 +4824,25 @@ static CURLcode create_conn(struct SessionHandle *data, if(result != CURLE_OK) return result; + + /************************************************************* + * If the protocol can't handle url query strings, then cut + * of the unhandable part + *************************************************************/ + if((conn->given->flags&PROTOPT_NOURLQUERY)) { + char *path_q_sep = strchr(conn->data->state.path, '?'); + if(path_q_sep) { + /* according to rfc3986, allow the query (?foo=bar) + also on protocols that can't handle it. + + cut the string-part after '?' + */ + + /* terminate the string */ + path_q_sep[0] = 0; + } + } + #ifndef CURL_DISABLE_PROXY /************************************************************* * Extract the user and password from the authentication string diff --git a/lib/urldata.h b/lib/urldata.h index 3e7db2525..55f0a7b85 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -713,6 +713,8 @@ struct Curl_handler { #define PROTOPT_NONETWORK (1<<4) /* protocol doesn't use the network! */ #define PROTOPT_NEEDSPWD (1<<5) /* needs a password, and if none is set it gets a default */ +#define PROTOPT_NOURLQUERY (1<<6) /* protocol can't handle + url query strings (?foo=bar) ! */ /* return the count of bytes sent, or -1 on error */ |