Imported Upstream version 7.50.2
[platform/upstream/curl.git] / lib / getinfo.c
index 39189cb..262cd93 100644 (file)
@@ -39,7 +39,7 @@
  * This is supposed to be called in the beginning of a perform() session
  * and should reset all session-info variables
  */
-CURLcode Curl_initinfo(struct SessionHandle *data)
+CURLcode Curl_initinfo(struct Curl_easy *data)
 {
   struct Progress *pro = &data->progress;
   struct PureInfo *info = &data->info;
@@ -73,7 +73,7 @@ CURLcode Curl_initinfo(struct SessionHandle *data)
   return CURLE_OK;
 }
 
-static CURLcode getinfo_char(struct SessionHandle *data, CURLINFO info,
+static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
                              char **param_charp)
 {
   switch(info) {
@@ -119,7 +119,7 @@ static CURLcode getinfo_char(struct SessionHandle *data, CURLINFO info,
   return CURLE_OK;
 }
 
-static CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info,
+static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
                              long *param_longp)
 {
   curl_socket_t sockfd;
@@ -198,6 +198,22 @@ static CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info,
   case CURLINFO_RTSP_CSEQ_RECV:
     *param_longp = data->state.rtsp_CSeq_recv;
     break;
+  case CURLINFO_HTTP_VERSION:
+    switch (data->info.httpversion) {
+    case 10:
+      *param_longp = CURL_HTTP_VERSION_1_0;
+      break;
+    case 11:
+      *param_longp = CURL_HTTP_VERSION_1_1;
+      break;
+    case 20:
+      *param_longp = CURL_HTTP_VERSION_2_0;
+      break;
+    default:
+      *param_longp = CURL_HTTP_VERSION_NONE;
+      break;
+    }
+    break;
 
   default:
     return CURLE_UNKNOWN_OPTION;
@@ -206,7 +222,7 @@ static CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info,
   return CURLE_OK;
 }
 
-static CURLcode getinfo_double(struct SessionHandle *data, CURLINFO info,
+static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
                                double *param_doublep)
 {
   switch(info) {
@@ -259,7 +275,7 @@ static CURLcode getinfo_double(struct SessionHandle *data, CURLINFO info,
   return CURLE_OK;
 }
 
-static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
+static CURLcode getinfo_slist(struct Curl_easy *data, CURLINFO info,
                               struct curl_slist **param_slistp)
 {
   union {
@@ -307,7 +323,7 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
 #elif defined(USE_GSKIT)
             tsi->internals = (void *)conn->ssl[i].handle;
 #elif defined(USE_MBEDTLS)
-            tsi->internals = (void *)&conn->ssl[i].ssn;
+            tsi->internals = (void *)&conn->ssl[i].ssl;
 #elif defined(USE_NSS)
             tsi->internals = (void *)conn->ssl[i].handle;
 #elif defined(USE_OPENSSL)
@@ -316,7 +332,7 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
                               (void *)conn->ssl[i].ctx :
                               (void *)conn->ssl[i].handle);
 #elif defined(USE_POLARSSL)
-            tsi->internals = (void *)&conn->ssl[i].ssn;
+            tsi->internals = (void *)&conn->ssl[i].ssl;
 #elif defined(USE_SCHANNEL)
             tsi->internals = (void *)&conn->ssl[i].ctxt->ctxt_handle;
 #elif defined(USE_SSL)
@@ -335,7 +351,7 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
   return CURLE_OK;
 }
 
-static CURLcode getinfo_socket(struct SessionHandle *data, CURLINFO info,
+static CURLcode getinfo_socket(struct Curl_easy *data, CURLINFO info,
                                curl_socket_t *param_socketp)
 {
   switch(info) {
@@ -349,7 +365,7 @@ static CURLcode getinfo_socket(struct SessionHandle *data, CURLINFO info,
   return CURLE_OK;
 }
 
-CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
+CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...)
 {
   va_list arg;
   long *param_longp = NULL;