diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-08-29 13:18:28 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-08-29 13:18:28 +0000 |
commit | 2e28718de3bfbef0645d830c62b297e187474f85 (patch) | |
tree | 055d9b19e442fe604038cdb1f814cb5763fef83c /src/transport/plugin_transport_http_client.c | |
parent | a4b74ef335873379d374d372bcce7c4228095bd5 (diff) | |
download | gnunet-2e28718de3bfbef0645d830c62b297e187474f85.tar.gz gnunet-2e28718de3bfbef0645d830c62b297e187474f85.zip |
changes
Diffstat (limited to 'src/transport/plugin_transport_http_client.c')
-rw-r--r-- | src/transport/plugin_transport_http_client.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 1f08d7bbb..e2bc39f0e 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | 35 | ||
36 | #define VERBOSE_CURL GNUNET_NO | 36 | #define VERBOSE_CURL GNUNET_YES |
37 | 37 | ||
38 | #include "platform.h" | 38 | #include "platform.h" |
39 | #include "gnunet_protocols.h" | 39 | #include "gnunet_protocols.h" |
@@ -322,10 +322,25 @@ client_exist_session (struct HTTP_Client_Plugin *plugin, struct Session *s) | |||
322 | static int | 322 | static int |
323 | client_log (CURL * curl, curl_infotype type, char *data, size_t size, void *cls) | 323 | client_log (CURL * curl, curl_infotype type, char *data, size_t size, void *cls) |
324 | { | 324 | { |
325 | if (type == CURLINFO_TEXT) | 325 | char *ttype; |
326 | if ((type == CURLINFO_TEXT) || (type == CURLINFO_HEADER_IN) || (type == CURLINFO_HEADER_OUT)) | ||
326 | { | 327 | { |
327 | char text[size + 2]; | 328 | char text[size + 2]; |
328 | 329 | ||
330 | switch (type) { | ||
331 | case CURLINFO_TEXT: | ||
332 | ttype = "TEXT"; | ||
333 | break; | ||
334 | case CURLINFO_HEADER_IN: | ||
335 | ttype = "HEADER_IN"; | ||
336 | break; | ||
337 | case CURLINFO_HEADER_OUT: | ||
338 | ttype = "HEADER_OUT"; | ||
339 | break; | ||
340 | default: | ||
341 | break; | ||
342 | } | ||
343 | |||
329 | memcpy (text, data, size); | 344 | memcpy (text, data, size); |
330 | if (text[size - 1] == '\n') | 345 | if (text[size - 1] == '\n') |
331 | text[size] = '\0'; | 346 | text[size] = '\0'; |
@@ -336,10 +351,10 @@ client_log (CURL * curl, curl_infotype type, char *data, size_t size, void *cls) | |||
336 | } | 351 | } |
337 | #if BUILD_HTTPS | 352 | #if BUILD_HTTPS |
338 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-https_client", | 353 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-https_client", |
339 | "Connection: %p - %s", cls, text); | 354 | "Connection %p %s: %s", cls, ttype, text); |
340 | #else | 355 | #else |
341 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-http_client", | 356 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-http_client", |
342 | "Connection %p: - %s", cls, text); | 357 | "Connection %p %s: %s", cls, ttype, text); |
343 | #endif | 358 | #endif |
344 | } | 359 | } |
345 | return 0; | 360 | return 0; |
@@ -918,7 +933,6 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
918 | client_schedule (plugin, GNUNET_NO); | 933 | client_schedule (plugin, GNUNET_NO); |
919 | } | 934 | } |
920 | 935 | ||
921 | |||
922 | static int | 936 | static int |
923 | client_connect (struct Session *s) | 937 | client_connect (struct Session *s) |
924 | { | 938 | { |
@@ -989,8 +1003,13 @@ client_connect (struct Session *s) | |||
989 | curl_easy_setopt (s->client_put, CURLOPT_SSL_VERIFYHOST, 0); | 1003 | curl_easy_setopt (s->client_put, CURLOPT_SSL_VERIFYHOST, 0); |
990 | #endif | 1004 | #endif |
991 | curl_easy_setopt (s->client_put, CURLOPT_URL, url); | 1005 | curl_easy_setopt (s->client_put, CURLOPT_URL, url); |
992 | curl_easy_setopt (s->client_put, CURLOPT_PUT, 1L); | 1006 | curl_easy_setopt (s->client_put, CURLOPT_UPLOAD, 1L); |
993 | //curl_easy_setopt (s->client_put, CURLOPT_HEADERFUNCTION, &curl_put_header_cb); | 1007 | /* |
1008 | struct curl_slist *m_headerlist; | ||
1009 | m_headerlist = NULL; | ||
1010 | m_headerlist = curl_slist_append(m_headerlist, "Transfer-Encoding: chunked"); | ||
1011 | curl_easy_setopt(s->client_put, CURLOPT_HTTPHEADER, m_headerlist);*/ | ||
1012 | //curl_easy_setopt (s->client_put, CURLOPT_HEADERFUNCTION, &client_curl_header); | ||
994 | //curl_easy_setopt (s->client_put, CURLOPT_WRITEHEADER, ps); | 1013 | //curl_easy_setopt (s->client_put, CURLOPT_WRITEHEADER, ps); |
995 | curl_easy_setopt (s->client_put, CURLOPT_READFUNCTION, client_send_cb); | 1014 | curl_easy_setopt (s->client_put, CURLOPT_READFUNCTION, client_send_cb); |
996 | curl_easy_setopt (s->client_put, CURLOPT_READDATA, s); | 1015 | curl_easy_setopt (s->client_put, CURLOPT_READDATA, s); |