+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Found target `%s' in url\n", GNUNET_h2s_full(&target->hashPubKey));
+ return GNUNET_OK;
+}
+
+
+/**
+ * Lookup a mhd connection and create one if none is found
+ *
+ * @param plugin the plugin handle
+ * @param mhd_connection the incoming mhd_connection
+ * @param url incoming requested URL
+ * @param method PUT or GET
+ * @return the server connecetion
+ */
+static struct ServerConnection *
+server_lookup_connection (struct HTTP_Server_Plugin *plugin,
+ struct MHD_Connection *mhd_connection, const char *url,
+ const char *method)
+{
+ struct Session *s = NULL;
+ struct ServerConnection *sc = NULL;
+ const union MHD_ConnectionInfo *conn_info;
+ struct GNUNET_ATS_Information ats;
+
+ char *addr;
+ size_t addr_len;
+
+ struct GNUNET_PeerIdentity target;
+ uint32_t tag = 0;
+ int direction = GNUNET_SYSERR;
+ int to;
+
+ conn_info = MHD_get_connection_info (mhd_connection,
+ MHD_CONNECTION_INFO_CLIENT_ADDRESS);
+ if ((conn_info->client_addr->sa_family != AF_INET) &&
+ (conn_info->client_addr->sa_family != AF_INET6))
+ return NULL;
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "New %s connection from %s\n", method, url);
+
+ if (GNUNET_SYSERR == server_parse_url (plugin, url, &target, &tag))
+ {
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Invalid url %s\n", url);
+ return NULL;
+ }