]> xenbits.xensource.com Git - libvirt.git/commitdiff
esx: Output error details from libcurl
authorMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 26 Jan 2010 01:05:45 +0000 (02:05 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 26 Jan 2010 20:23:18 +0000 (21:23 +0100)
src/esx/esx_vi.c
src/esx/esx_vi.h

index 0fe953593ccf965c7b08b44c52013ea9d0bab601..bc9432652910b7858f8ccdba7c1dbcac47449a8c 100644 (file)
@@ -251,8 +251,8 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
 
     if (errorCode != CURLE_OK) {
         ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
-                     "curl_easy_perform() returned an error: %s (%d)",
-                     curl_easy_strerror(errorCode), errorCode);
+                     "curl_easy_perform() returned an error: %s (%d) : %s",
+                     curl_easy_strerror(errorCode), errorCode, ctx->curl_error);
         return -1;
     }
 
@@ -262,8 +262,8 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
     if (errorCode != CURLE_OK) {
         ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
-                     "error: %s (%d)", curl_easy_strerror(errorCode),
-                     errorCode);
+                     "error: %s (%d) : %s", curl_easy_strerror(errorCode),
+                     errorCode, ctx->curl_error);
         return -1;
     }
 
@@ -282,8 +282,8 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
         if (errorCode != CURLE_OK) {
             ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned "
-                         "an error: %s (%d)", curl_easy_strerror(errorCode),
-                         errorCode);
+                         "an error: %s (%d) : %s", curl_easy_strerror(errorCode),
+                         errorCode, ctx->curl_error);
         } else {
             ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "The server redirects from '%s' to '%s'", url,
@@ -360,6 +360,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
                      esxVI_CURL_ReadString);
     curl_easy_setopt(ctx->curl_handle, CURLOPT_WRITEFUNCTION,
                      esxVI_CURL_WriteBuffer);
+    curl_easy_setopt(ctx->curl_handle, CURLOPT_ERRORBUFFER,
+                     ctx->curl_error);
 #if ESX_VI__CURL__ENABLE_DEBUG_OUTPUT
     curl_easy_setopt(ctx->curl_handle, CURLOPT_DEBUGFUNCTION, esxVI_CURL_Debug);
     curl_easy_setopt(ctx->curl_handle, CURLOPT_VERBOSE, 1);
index 608dcbda812d511da28a10bbc85b50b41b4ec8ee..4e8b67513865ba7148b622b8b7ec44fbd70265d4 100644 (file)
@@ -77,6 +77,7 @@ struct _esxVI_Context {
     char *ipAddress;
     CURL *curl_handle;
     struct curl_slist *curl_headers;
+    char curl_error[CURL_ERROR_SIZE];
     virMutex curl_lock;
     char *username;
     char *password;