bash - Can curl default to using https? -


i have script acts wrapper around curl: accepts of curl's arguments adds of own (like -h 'content-type: application/json'), , parsing of output.

the problem curl accepts curl google.com meaning curl http://google.com. want force https connection, don't want parse curl's command line find , edit hostname. (the user might have typed curlwrapper -h "foo: bar" -xpost google.com -d '{"hello":"world"}')

is there way tell curl "use https connection when you're not given url scheme"?

it not appear possible due how libcurl determines protocol use when no scheme given. excerpt the code:

  /*    * since there no protocol part specified, guess protocol    * based on first letters of server name.    */    /* note: if add new protocol, please update list in    * lib/version.c too! */    if(checkprefix("ftp.", conn->host.name))     protop = "ftp";   else if(checkprefix("dict.", conn->host.name))     protop = "dict";   else if(checkprefix("ldap.", conn->host.name))     protop = "ldap";   else if(checkprefix("imap.", conn->host.name))     protop = "imap";   else if(checkprefix("smtp.", conn->host.name))     protop = "smtp";   else if(checkprefix("pop3.", conn->host.name))     protop = "pop3";   else {     protop = "http";   } 

Comments