this CURL **handle**.
The **scheme** pointer is NULL or points to private memory. You MUST NOT
-free - it gets freed when you call curl_easy_cleanup(3) on the
-corresponding CURL handle.
+free - it gets freed when you call curl_easy_cleanup(3) on the corresponding
+CURL handle.
+
+The returned scheme might be upper or lowercase. Do comparisons case
+insensitively.
# EXAMPLE
*/
const struct Curl_handler Curl_handler_rtmp = {
- "RTMP", /* scheme */
+ "rtmp", /* scheme */
rtmp_setup_connection, /* setup_connection */
rtmp_do, /* do_it */
rtmp_done, /* done */
};
const struct Curl_handler Curl_handler_rtmpt = {
- "RTMPT", /* scheme */
+ "rtmpt", /* scheme */
rtmp_setup_connection, /* setup_connection */
rtmp_do, /* do_it */
rtmp_done, /* done */
};
const struct Curl_handler Curl_handler_rtmpe = {
- "RTMPE", /* scheme */
+ "rtmpe", /* scheme */
rtmp_setup_connection, /* setup_connection */
rtmp_do, /* do_it */
rtmp_done, /* done */
};
const struct Curl_handler Curl_handler_rtmpte = {
- "RTMPTE", /* scheme */
+ "rtmpte", /* scheme */
rtmp_setup_connection, /* setup_connection */
rtmp_do, /* do_it */
rtmp_done, /* done */
};
const struct Curl_handler Curl_handler_rtmps = {
- "RTMPS", /* scheme */
+ "rtmps", /* scheme */
rtmp_setup_connection, /* setup_connection */
rtmp_do, /* do_it */
rtmp_done, /* done */
};
const struct Curl_handler Curl_handler_rtmpts = {
- "RTMPTS", /* scheme */
+ "rtmpts", /* scheme */
rtmp_setup_connection, /* setup_connection */
rtmp_do, /* do_it */
rtmp_done, /* done */
*/
const struct Curl_handler Curl_handler_dict = {
- "DICT", /* scheme */
+ "dict", /* scheme */
ZERO_NULL, /* setup_connection */
dict_do, /* do_it */
ZERO_NULL, /* done */
*/
const struct Curl_handler Curl_handler_file = {
- "FILE", /* scheme */
+ "file", /* scheme */
file_setup_connection, /* setup_connection */
file_do, /* do_it */
file_done, /* done */
*/
const struct Curl_handler Curl_handler_ftp = {
- "FTP", /* scheme */
+ "ftp", /* scheme */
ftp_setup_connection, /* setup_connection */
ftp_do, /* do_it */
ftp_done, /* done */
*/
const struct Curl_handler Curl_handler_ftps = {
- "FTPS", /* scheme */
+ "ftps", /* scheme */
ftp_setup_connection, /* setup_connection */
ftp_do, /* do_it */
ftp_done, /* done */
*/
const struct Curl_handler Curl_handler_gopher = {
- "GOPHER", /* scheme */
+ "gopher", /* scheme */
ZERO_NULL, /* setup_connection */
gopher_do, /* do_it */
ZERO_NULL, /* done */
#ifdef USE_SSL
const struct Curl_handler Curl_handler_gophers = {
- "GOPHERS", /* scheme */
+ "gophers", /* scheme */
ZERO_NULL, /* setup_connection */
gopher_do, /* do_it */
ZERO_NULL, /* done */
* HTTP handler interface.
*/
const struct Curl_handler Curl_handler_http = {
- "HTTP", /* scheme */
+ "http", /* scheme */
Curl_http_setup_conn, /* setup_connection */
Curl_http, /* do_it */
Curl_http_done, /* done */
* HTTPS handler interface.
*/
const struct Curl_handler Curl_handler_https = {
- "HTTPS", /* scheme */
+ "https", /* scheme */
Curl_http_setup_conn, /* setup_connection */
Curl_http, /* do_it */
Curl_http_done, /* done */
*/
const struct Curl_handler Curl_handler_imap = {
- "IMAP", /* scheme */
+ "imap", /* scheme */
imap_setup_connection, /* setup_connection */
imap_do, /* do_it */
imap_done, /* done */
*/
const struct Curl_handler Curl_handler_imaps = {
- "IMAPS", /* scheme */
+ "imaps", /* scheme */
imap_setup_connection, /* setup_connection */
imap_do, /* do_it */
imap_done, /* done */
*/
const struct Curl_handler Curl_handler_ldap = {
- "LDAP", /* scheme */
+ "ldap", /* scheme */
ZERO_NULL, /* setup_connection */
ldap_do, /* do_it */
ZERO_NULL, /* done */
*/
const struct Curl_handler Curl_handler_ldaps = {
- "LDAPS", /* scheme */
+ "ldaps", /* scheme */
ZERO_NULL, /* setup_connection */
ldap_do, /* do_it */
ZERO_NULL, /* done */
*/
const struct Curl_handler Curl_handler_mqtt = {
- "MQTT", /* scheme */
+ "mqtt", /* scheme */
mqtt_setup_conn, /* setup_connection */
mqtt_do, /* do_it */
mqtt_done, /* done */
*/
const struct Curl_handler Curl_handler_ldap = {
- "LDAP", /* scheme */
+ "ldap", /* scheme */
oldap_setup_connection, /* setup_connection */
oldap_do, /* do_it */
oldap_done, /* done */
*/
const struct Curl_handler Curl_handler_ldaps = {
- "LDAPS", /* scheme */
+ "ldaps", /* scheme */
oldap_setup_connection, /* setup_connection */
oldap_do, /* do_it */
oldap_done, /* done */
*/
const struct Curl_handler Curl_handler_pop3 = {
- "POP3", /* scheme */
+ "pop3", /* scheme */
pop3_setup_connection, /* setup_connection */
pop3_do, /* do_it */
pop3_done, /* done */
*/
const struct Curl_handler Curl_handler_pop3s = {
- "POP3S", /* scheme */
+ "pop3s", /* scheme */
pop3_setup_connection, /* setup_connection */
pop3_do, /* do_it */
pop3_done, /* done */
* RTSP handler interface.
*/
const struct Curl_handler Curl_handler_rtsp = {
- "RTSP", /* scheme */
+ "rtsp", /* scheme */
rtsp_setup_connection, /* setup_connection */
rtsp_do, /* do_it */
rtsp_done, /* done */
* SMB handler interface
*/
const struct Curl_handler Curl_handler_smb = {
- "SMB", /* scheme */
+ "smb", /* scheme */
smb_setup_connection, /* setup_connection */
smb_do, /* do_it */
ZERO_NULL, /* done */
* SMBS handler interface
*/
const struct Curl_handler Curl_handler_smbs = {
- "SMBS", /* scheme */
+ "smbs", /* scheme */
smb_setup_connection, /* setup_connection */
smb_do, /* do_it */
ZERO_NULL, /* done */
*/
const struct Curl_handler Curl_handler_smtp = {
- "SMTP", /* scheme */
+ "smtp", /* scheme */
smtp_setup_connection, /* setup_connection */
smtp_do, /* do_it */
smtp_done, /* done */
*/
const struct Curl_handler Curl_handler_smtps = {
- "SMTPS", /* scheme */
+ "smtps", /* scheme */
smtp_setup_connection, /* setup_connection */
smtp_do, /* do_it */
smtp_done, /* done */
*/
const struct Curl_handler Curl_handler_telnet = {
- "TELNET", /* scheme */
+ "telnet", /* scheme */
ZERO_NULL, /* setup_connection */
telnet_do, /* do_it */
telnet_done, /* done */
*/
const struct Curl_handler Curl_handler_tftp = {
- "TFTP", /* scheme */
+ "tftp", /* scheme */
tftp_setup_connection, /* setup_connection */
tftp_do, /* do_it */
tftp_done, /* done */
* For compatibility, the all-uppercase versions of these variables are
* checked if the lowercase versions don't exist.
*/
- char proxy_env[128];
- const char *protop = conn->handler->scheme;
+ char proxy_env[20];
char *envp = proxy_env;
#ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)data;
#endif
- /* Now, build <protocol>_proxy and check for such a one to use */
- while(*protop)
- *envp++ = Curl_raw_tolower(*protop++);
-
- /* append _proxy */
- strcpy(envp, "_proxy");
+ msnprintf(proxy_env, sizeof(proxy_env), "%s_proxy", conn->handler->scheme);
/* read the protocol proxy: */
proxy = curl_getenv(proxy_env);
proxy = curl_getenv(proxy_env);
}
- envp = proxy_env;
if(!proxy) {
#ifdef USE_WEBSOCKETS
/* websocket proxy fallbacks */
*/
struct Curl_handler {
- const char *scheme; /* URL scheme name. */
+ const char *scheme; /* URL scheme name in lowercase */
/* Complement to setup_connection_internals(). This is done before the
transfer "owns" the connection. */
Content-Type: text/plain
testdata
-HTTP
+http
</stdout>
<protocol>
GET /%TESTNUMBER HTTP/1.1\r
\r
</protocol>
<stdout nonewline="yes">
-{"certs":"","content_type":"text/html","conn_id":0,"errormsg":null,"exitcode":0,"filename_effective":"%LOGDIR/out%TESTNUMBER","ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"1.1","local_ip":"127.0.0.1","local_port":13,"method":"GET","num_certs":0,"num_connects":1,"num_headers":9,"num_redirects":0,"proxy_ssl_verify_result":0,"proxy_used":0,"redirect_url":null,"referer":null,"remote_ip":"%HOSTIP","remote_port":%HTTPPORT,"response_code":200,"scheme":"HTTP","size_download":445,"size_header":4019,"size_request":4019,"size_upload":0,"speed_download":13,"speed_upload":13,"ssl_verify_result":0,"time_appconnect":0.000013,"time_connect":0.000013,"time_namelookup":0.000013,"time_pretransfer":0.000013,"time_redirect":0.000013,"time_starttransfer":0.000013,"time_total":0.000013,"url":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","url.scheme":"http","url.user":null,"url.password":null,"url.options":null,"url.host":"%HOSTIP","url.port":"%HTTPPORT","url.path":"/%TESTNUMBER","url.query":null,"url.fragment":null,"url.zoneid":null,"urle.scheme":"http","urle.user":null,"urle.password":null,"urle.options":null,"urle.host":"%HOSTIP","urle.port":"%HTTPPORT","urle.path":"/%TESTNUMBER","urle.query":null,"urle.fragment":null,"urle.zoneid":null,"url_effective":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","urlnum":0,"xfer_id":0,"curl_version":"curl-unit-test-fake-version"}
+{"certs":"","content_type":"text/html","conn_id":0,"errormsg":null,"exitcode":0,"filename_effective":"%LOGDIR/out%TESTNUMBER","ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"1.1","local_ip":"127.0.0.1","local_port":13,"method":"GET","num_certs":0,"num_connects":1,"num_headers":9,"num_redirects":0,"proxy_ssl_verify_result":0,"proxy_used":0,"redirect_url":null,"referer":null,"remote_ip":"%HOSTIP","remote_port":%HTTPPORT,"response_code":200,"scheme":"http","size_download":445,"size_header":4019,"size_request":4019,"size_upload":0,"speed_download":13,"speed_upload":13,"ssl_verify_result":0,"time_appconnect":0.000013,"time_connect":0.000013,"time_namelookup":0.000013,"time_pretransfer":0.000013,"time_redirect":0.000013,"time_starttransfer":0.000013,"time_total":0.000013,"url":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","url.scheme":"http","url.user":null,"url.password":null,"url.options":null,"url.host":"%HOSTIP","url.port":"%HTTPPORT","url.path":"/%TESTNUMBER","url.query":null,"url.fragment":null,"url.zoneid":null,"urle.scheme":"http","urle.user":null,"urle.password":null,"urle.options":null,"urle.host":"%HOSTIP","urle.port":"%HTTPPORT","urle.path":"/%TESTNUMBER","urle.query":null,"urle.fragment":null,"urle.zoneid":null,"url_effective":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","urlnum":0,"xfer_id":0,"curl_version":"curl-unit-test-fake-version"}
</stdout>
</verify>
</testcase>
\r
</protocol>
<stdout mode="text">
-{"certs":"","content_type":"text/html","conn_id":0,"errormsg":null,"exitcode":0,"filename_effective":"%LOGDIR/out972","ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"1.1","local_ip":"%HOSTIP","local_port":13,"method":"GET","num_certs":0,"num_connects":1,"num_headers":9,"num_redirects":0,"proxy_ssl_verify_result":0,"proxy_used":0,"redirect_url":null,"referer":null,"remote_ip":"%HOSTIP","remote_port":%HTTPPORT,"response_code":200,"scheme":"HTTP","size_download":445,"size_header":4019,"size_request":4019,"size_upload":0,"speed_download":13,"speed_upload":13,"ssl_verify_result":0,"time_appconnect":0.000013,"time_connect":0.000013,"time_namelookup":0.000013,"time_pretransfer":0.000013,"time_redirect":0.000013,"time_starttransfer":0.000013,"time_total":0.000013,"url":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","url.scheme":"http","url.user":null,"url.password":null,"url.options":null,"url.host":"%HOSTIP","url.port":"%HTTPPORT","url.path":"/%TESTNUMBER","url.query":null,"url.fragment":null,"url.zoneid":null,"urle.scheme":"http","urle.user":null,"urle.password":null,"urle.options":null,"urle.host":"%HOSTIP","urle.port":"%HTTPPORT","urle.path":"/%TESTNUMBER","urle.query":null,"urle.fragment":null,"urle.zoneid":null,"url_effective":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","urlnum":0,"xfer_id":0,"curl_version":"curl-unit-test-fake-version"}
+{"certs":"","content_type":"text/html","conn_id":0,"errormsg":null,"exitcode":0,"filename_effective":"%LOGDIR/out972","ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"1.1","local_ip":"%HOSTIP","local_port":13,"method":"GET","num_certs":0,"num_connects":1,"num_headers":9,"num_redirects":0,"proxy_ssl_verify_result":0,"proxy_used":0,"redirect_url":null,"referer":null,"remote_ip":"%HOSTIP","remote_port":%HTTPPORT,"response_code":200,"scheme":"http","size_download":445,"size_header":4019,"size_request":4019,"size_upload":0,"speed_download":13,"speed_upload":13,"ssl_verify_result":0,"time_appconnect":0.000013,"time_connect":0.000013,"time_namelookup":0.000013,"time_pretransfer":0.000013,"time_redirect":0.000013,"time_starttransfer":0.000013,"time_total":0.000013,"url":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","url.scheme":"http","url.user":null,"url.password":null,"url.options":null,"url.host":"%HOSTIP","url.port":"%HTTPPORT","url.path":"/%TESTNUMBER","url.query":null,"url.fragment":null,"url.zoneid":null,"urle.scheme":"http","urle.user":null,"urle.password":null,"urle.options":null,"urle.host":"%HOSTIP","urle.port":"%HTTPPORT","urle.path":"/%TESTNUMBER","urle.query":null,"urle.fragment":null,"urle.zoneid":null,"url_effective":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","urlnum":0,"xfer_id":0,"curl_version":"curl-unit-test-fake-version"}
</stdout>
</verify>
</testcase>
__FILE__, __LINE__, res, curl_easy_strerror(res));
goto test_cleanup;
}
- if(!scheme || memcmp(scheme, "HTTP", 5) != 0) {
+ if(!scheme || memcmp(scheme, "http", 5) != 0) {
fprintf(stderr, "%s:%d scheme of http resource is incorrect; "
- "expected 'HTTP' but is %s\n",
+ "expected 'http' but is %s\n",
__FILE__, __LINE__,
(scheme == NULL ? "NULL" : "invalid"));
res = CURLE_HTTP_RETURNED_ERROR;