http_server_plugin_address_suggested (void *cls, const void *addr,
size_t addrlen)
{
- struct HTTP_Server_Plugin *plugin = cls;
struct HttpAddressWrapper *next;
struct HttpAddressWrapper *pos;
+ struct HttpAddress *h_addr;
+ h_addr = (struct HttpAddress *) addr;
-
- if ((NULL != plugin->ext_addr) &&
+ if ((NULL != p->ext_addr) &&
GNUNET_YES == (http_common_cmp_addresses (addr, addrlen,
- plugin->ext_addr, plugin->ext_addr_len)))
- return GNUNET_OK;
+ p->ext_addr, p->ext_addr_len)))
+ {
+ /* Checking HTTP_OPTIONS_VERIFY_CERTIFICATE option for external hostname */
+ if ((ntohl(h_addr->options) & HTTP_OPTIONS_VERIFY_CERTIFICATE) !=
+ (p->options & HTTP_OPTIONS_VERIFY_CERTIFICATE))
+ return GNUNET_NO; /* VERIFY option not set as required! */
+ return GNUNET_OK;
+ }
- next = plugin->addr_head;
+ next = p->addr_head;
while (NULL != (pos = next))
{
next = pos->next;
ats.type = htonl (GNUNET_ATS_NET_WAN);
return NULL;
}
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Creating new session for peer `%s' connecting from `%s'\n",
- GNUNET_i2s (&target),
- http_common_plugin_address_to_string (NULL, p->protocol, addr, addr_len));
s = GNUNET_malloc (sizeof (struct Session));
memcpy (&s->target, &target, sizeof (struct GNUNET_PeerIdentity));
s->connect_in_progress = GNUNET_YES;
server_start_session_timeout(s);
GNUNET_CONTAINER_DLL_insert (plugin->head, plugin->tail, s);
+
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Creating new session %p for peer `%s' connecting from `%s'\n",
+ s, GNUNET_i2s (&target),
+ http_common_plugin_address_to_string (NULL, p->protocol, addr, addr_len));
}
sc = GNUNET_malloc (sizeof (struct ServerConnection));
if (conn_info->client_addr->sa_family == AF_INET)
if ((NULL != s->server_send) && (NULL != s->server_recv))
{
s->connect_in_progress = GNUNET_NO; /* PUT and GET are connected */
- plugin->env->session_start (NULL, &s->target, PLUGIN_NAME,s->addr, s->addrlen,s, NULL, 0);
+ plugin->env->session_start (NULL, &s->target, PLUGIN_NAME, NULL, 0 ,s, NULL, 0);
}
#if MHD_VERSION >= 0x00090E00
delay = plugin->env->receive (plugin->env->cls,
&s->target,
message,
- s, s->addr, s->addrlen);
+ s, NULL, 0);
plugin->env->update_address_metrics (plugin->env->cls,
&s->target,
- s->addr,
- s->addrlen,
- s,
- &atsi, 1);
+ NULL, 0, s, &atsi, 1);
GNUNET_asprintf (&stat_txt, "# bytes received via %s_server", plugin->protocol);
GNUNET_STATISTICS_update (plugin->env->stats,
const void *addr,
size_t addrlen)
{
- return http_common_plugin_address_to_string (cls, p->protocol, addr, addrlen);
+#if BUILD_HTTPS
+ return http_common_plugin_address_to_string (cls, PLUGIN_NAME, addr, addrlen);
+#else
+ return http_common_plugin_address_to_string (cls, PLUGIN_NAME, addr, addrlen);
+#endif
+
}
+
/**
* Function obtain the network type for a session
*
* @return the network type in HBO or GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
-http_server_get_network (void *cls, void *session)
+http_server_get_network (void *cls,
+ struct Session *session)
{
- struct Session *s = (struct Session *) session;
- GNUNET_assert (NULL != s);
- return ntohl(s->ats_address_network_type);
+ GNUNET_assert (NULL != session);
+ return ntohl (session->ats_address_network_type);
}
+
/**
* Entry point for the plugin.
*