* gpgkeys_hkp.c (main), gpgkeys_curl.c (main), curl-shim.h: Show
[gnupg.git] / keyserver / curl-shim.c
index 8575be2..7f9d431 100644 (file)
@@ -45,6 +45,10 @@ handle_error(CURL *curl,CURLcode err,const char *str)
          strcpy(curl->errorbuffer,"okay");
          break;
 
+       case CURLE_UNSUPPORTED_PROTOCOL:
+         strcpy(curl->errorbuffer,"unsupported protocol");
+         break;
+
        case CURLE_COULDNT_CONNECT:
          strcpy(curl->errorbuffer,"couldn't connect");
          break;
@@ -208,7 +212,7 @@ curl_easy_perform(CURL *curl)
                        }
                    }
 
-                 m_free(line);
+                 xfree(line);
                  http_close(&curl->hd);
                }
            }
@@ -217,16 +221,26 @@ curl_easy_perform(CURL *curl)
        }
     }
 
-  if(rc!=0)
+  switch(rc)
     {
-      if(rc==G10ERR_NETWORK)
-       errstr=strerror(errno);
-      else
-       errstr=g10_errstr(rc);
+    case 0:
+      break;
+
+    case G10ERR_INVALID_URI:
+      err=CURLE_UNSUPPORTED_PROTOCOL;
+      break;
 
+    case G10ERR_NETWORK:
+      errstr=strerror(errno);
       err=CURLE_COULDNT_CONNECT;
-    }
+      break;
 
+    default:
+      errstr=g10_errstr(rc);
+      err=CURLE_COULDNT_CONNECT;
+      break;
+    }
+      
   return handle_error(curl,err,errstr);
 }