aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-09-10 14:46:04 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-09-10 14:46:04 +0000
commit39638b297d6522f4ba3655020e283c97f0eac06f (patch)
tree448978ba8f68464c3ed737f45fef29ea0f85a437 /src/transport/plugin_transport_http.c
parent409c2404410b706d2eadacee3db61db76ff6b50e (diff)
downloadgnunet-39638b297d6522f4ba3655020e283c97f0eac06f.tar.gz
gnunet-39638b297d6522f4ba3655020e283c97f0eac06f.zip
added curl logger to integrate curl messages with gnunet log
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r--src/transport/plugin_transport_http.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 5c0708e38..2b52f37c4 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -53,7 +53,7 @@
53#endif 53#endif
54 54
55#define DEBUG_HTTP GNUNET_NO 55#define DEBUG_HTTP GNUNET_NO
56#define DEBUG_CURL GNUNET_NO 56#define DEBUG_CURL GNUNET_YES
57#define DEBUG_MHD GNUNET_NO 57#define DEBUG_MHD GNUNET_NO
58#define DEBUG_CONNECTIONS GNUNET_NO 58#define DEBUG_CONNECTIONS GNUNET_NO
59#define DEBUG_SESSION_SELECTION GNUNET_NO 59#define DEBUG_SESSION_SELECTION GNUNET_NO
@@ -1691,6 +1691,34 @@ static int curl_schedule(struct Plugin *plugin)
1691} 1691}
1692 1692
1693/** 1693/**
1694 * Function to log curl debug messages with GNUNET_log
1695 * @param curl handle
1696 * @param type curl_infotype
1697 * @param data data
1698 * @param size size
1699 * @param cls closure
1700 * @return 0
1701 */
1702int curl_logger (CURL * curl, curl_infotype type , char * data, size_t size , void * cls)
1703{
1704 char * text = GNUNET_malloc(size+2);
1705 if (type == CURLINFO_TEXT)
1706 {
1707 memcpy(text,data,size);
1708 if (text[size-1] == '\n')
1709 text[size] = '\0';
1710 else
1711 {
1712 text[size] = '\n';
1713 text[size+1] = '\0';
1714 }
1715 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"CURL: Connection %X - %s", cls, text);
1716 GNUNET_free(text);
1717 }
1718 return 0;
1719}
1720
1721/**
1694 * Function setting up curl handle and selecting message to send 1722 * Function setting up curl handle and selecting message to send
1695 * 1723 *
1696 * @param plugin plugin 1724 * @param plugin plugin
@@ -1718,6 +1746,8 @@ static int send_check_connections (struct Plugin *plugin, struct Session *ps)
1718 } 1746 }
1719#if DEBUG_CURL 1747#if DEBUG_CURL
1720 curl_easy_setopt(ps->recv_endpoint, CURLOPT_VERBOSE, 1L); 1748 curl_easy_setopt(ps->recv_endpoint, CURLOPT_VERBOSE, 1L);
1749 curl_easy_setopt(ps->recv_endpoint, CURLOPT_DEBUGFUNCTION , &curl_logger);
1750 curl_easy_setopt(ps->recv_endpoint, CURLOPT_DEBUGDATA , ps->recv_endpoint);
1721#endif 1751#endif
1722#if BUILD_HTTPS 1752#if BUILD_HTTPS
1723 curl_easy_setopt (ps->recv_endpoint, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); 1753 curl_easy_setopt (ps->recv_endpoint, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
@@ -1814,6 +1844,8 @@ static int send_check_connections (struct Plugin *plugin, struct Session *ps)
1814 1844
1815#if DEBUG_CURL 1845#if DEBUG_CURL
1816 curl_easy_setopt(ps->send_endpoint, CURLOPT_VERBOSE, 1L); 1846 curl_easy_setopt(ps->send_endpoint, CURLOPT_VERBOSE, 1L);
1847 curl_easy_setopt(ps->send_endpoint, CURLOPT_DEBUGFUNCTION , &curl_logger);
1848 curl_easy_setopt(ps->send_endpoint, CURLOPT_DEBUGDATA , ps->send_endpoint);
1817#endif 1849#endif
1818#if BUILD_HTTPS 1850#if BUILD_HTTPS
1819 curl_easy_setopt (ps->send_endpoint, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); 1851 curl_easy_setopt (ps->send_endpoint, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);