#include <curl/curl.h>
#define VERBOSE GNUNET_YES
-#define DEBUG GNUNET_YES
-#define DEBUG_CURL GNUNET_YES
+#define DEBUG GNUNET_NO
+#define DEBUG_CURL GNUNET_NO
#define HTTP_BUFFER_SIZE 2048
#define PLUGIN libgnunet_plugin_transport_template
return;
}
+
+#if 0
/**
* Continuation called after plugin send message
* @cls closure
fail = GNUNET_NO;
shutdown_clean();
}
+#endif
/**
* Task sending recieved message back to peer
* @cls closure
* @tc task context
*/
+
static void
task_send (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
if (GNUNET_YES==sent)
return;
-
+/*
struct GNUNET_MessageHeader * msg = cls;
unsigned int len = ntohs(msg->size);
const char * msgc = (const char *) msg;
api->send(api->cls, p, msgc, len, 0, TIMEOUT, NULL,NULL, 0, GNUNET_NO, &task_send_cont, NULL);
+ */
sent = GNUNET_YES;
-
}
+
/**
* Recieves messages from plugin, in real world transport
*/
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testcase recieved new message from peer `%s' with type %u and length %u\n", GNUNET_i2s(peer),ntohs(message->type),ntohs(message->size));
/* take recieved message and send it back to peer */
+
+
p = peer;
void * c = (void *) message;
ti_send =GNUNET_SCHEDULER_add_delayed (sched, WAIT_INTERVALL, &task_send, c);
memcpy(tmp,ptr,len);
if (tmp[len-2] == 13)
tmp[len-2]= '\0';
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Header: `%s'\n"),tmp);
+#if DEBUG_CURL
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Header: `%s'\n",tmp);
+#endif
if (0==strcmp (tmp,"HTTP/1.1 100 Continue"))
{
res->http_result_code=100;
{
res->http_result_code=200;
}
+ if (0==strcmp (tmp,"HTTP/1.1 400 Bad Request"))
+ {
+ res->http_result_code=400;
+ }
if (0==strcmp (tmp,"HTTP/1.1 404 Not Found"))
{
res->http_result_code=404;
}
+ if (0==strcmp (tmp,"HTTP/1.1 413 Request entity too large"))
+ {
+ res->http_result_code=413;
+ }
GNUNET_free (tmp);
return size * nmemb;
}
if (res == &test_valid_ident)
{
- if ((res->http_result_code==200))
+ if ((res->http_result_code==400))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with valid peer identification: test passed\n"));
res->test_failed = GNUNET_NO;