[sr-dev] git:master:e3f788ea: http_client Improve curl error handling

Olle E. Johansson oej at edvina.net
Mon Mar 28 12:21:46 CEST 2016


Module: kamailio
Branch: master
Commit: e3f788ea94c52e09a9b1f0b2e3242fe4991df3b0
URL: https://github.com/kamailio/kamailio/commit/e3f788ea94c52e09a9b1f0b2e3242fe4991df3b0

Author: Olle E. Johansson <oej at edvina.net>
Committer: Olle E. Johansson <oej at edvina.net>
Date: 2016-03-28T12:21:23+02:00

http_client Improve curl error handling

---

Modified: modules/http_client/functions.c

---

Diff:  https://github.com/kamailio/kamailio/commit/e3f788ea94c52e09a9b1f0b2e3242fe4991df3b0.diff
Patch: https://github.com/kamailio/kamailio/commit/e3f788ea94c52e09a9b1f0b2e3242fe4991df3b0.patch

---

diff --git a/modules/http_client/functions.c b/modules/http_client/functions.c
index 15a91f3..7e26844 100644
--- a/modules/http_client/functions.c
+++ b/modules/http_client/functions.c
@@ -221,9 +221,33 @@ static int curL_query_url(struct sip_msg* _m, const char* _url, str* _dst, const
 	if (res == CURLE_COULDNT_CONNECT) {
 		LM_WARN("failed to connect() to host\n");
 	} else if ( res == CURLE_COULDNT_RESOLVE_HOST ) {
-		LM_WARN("couldn't resolve host\n");
+		LM_WARN("Couldn't resolve host\n");
 	} else if ( res == CURLE_COULDNT_RESOLVE_PROXY ) {
-		LM_WARN("couldn't resolve http_proxy host\n");
+		LM_WARN("Couldn't resolve http_proxy host\n");
+	} else if ( res == CURLE_UNSUPPORTED_PROTOCOL ) {
+		LM_WARN("URL Schema not supported by curl\n");
+	} else if ( res == CURLE_URL_MALFORMAT ) {
+		LM_WARN("Malformed URL used in http_client\n");
+	} else if ( res == CURLE_OUT_OF_MEMORY ) {
+		LM_WARN("Curl library out of memory\n");
+	} else if ( res == CURLE_OPERATION_TIMEDOUT ) {
+		LM_WARN("Curl library timed out on request\n");
+	} else if ( res == CURLE_SSL_CONNECT_ERROR ) {
+		LM_WARN("TLS error in curl connection\n");
+	} else if ( res == CURLE_SSL_CERTPROBLEM ) {
+		LM_WARN("TLS local certificate error\n");
+	} else if ( res == CURLE_SSL_CIPHER ) {
+		LM_WARN("TLS cipher error\n");
+	} else if ( res == CURLE_SSL_CACERT ) {
+		LM_WARN("TLS server certificate validation error (No valid CA cert)\n");
+	} else if ( res == CURLE_SSL_CACERT_BADFILE ) {
+		LM_WARN("TLS CA certificate read error \n");
+	} else if ( res == CURLE_SSL_ISSUER_ERROR ) {
+		LM_WARN("TLS issuer certificate check error \n");
+	} else if ( res == CURLE_PEER_FAILED_VERIFICATION ) {
+		LM_WARN("TLS verification error\n");
+	} else if ( res == CURLE_TOO_MANY_REDIRECTS ) {
+		LM_WARN("Too many redirects\n");
 	} else {
 		LM_ERR("failed to perform curl (%d)\n", res);
 	}




More information about the sr-dev mailing list