#include "gnunet_gns_service.h"
#include "gnunet_identity_service.h"
#include "gns.h"
-
+#include "gnunet_mhd_compat.h"
/**
* Default Socks5 listen port.
* #MHD_NO if the socket must be closed due to a serious
* error while handling the request
*/
-static int
+static MHD_RESULT
create_response (void *cls,
struct MHD_Connection *con,
const char *url,
{
struct Socks5ServerResponseMessage *s_resp;
+ GNUNET_break (0 == s5r->wbuf_len); /* Should happen first in any transmission, right? */
+ GNUNET_assert (SOCKS_BUFFERSIZE - s5r->wbuf_len >=
+ sizeof(struct Socks5ServerResponseMessage));
s_resp = (struct Socks5ServerResponseMessage *) &s5r->wbuf[s5r->wbuf_len];
memset (s_resp, 0, sizeof(struct Socks5ServerResponseMessage));
s_resp->version = SOCKS_VERSION_5;
+ alen + sizeof(uint16_t))
return; /* need more data */
dom_name = (const char *) &dom_len[1];
- port = (const uint16_t*) &dom_name[*dom_len];
+ port = (const uint16_t *) &dom_name[*dom_len];
s5r->domain = GNUNET_strndup (dom_name,
*dom_len);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
s5r->gns_lookup = GNUNET_GNS_lookup_with_tld (gns_handle,
s5r->domain,
GNUNET_DNSPARSER_TYPE_A,
- GNUNET_NO /* only cached */,
+ GNUNET_GNS_LO_LOCAL_MASTER /* only cached */,
&handle_gns_result,
s5r);
break;