aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_http_common.c')
-rw-r--r--src/transport/plugin_transport_http_common.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
index 763c252ea..4cc6a84b2 100644
--- a/src/transport/plugin_transport_http_common.c
+++ b/src/transport/plugin_transport_http_common.c
@@ -209,8 +209,7 @@ http_common_plugin_address_pretty_printer (void *cls,
209 const struct HttpAddress *address = addr; 209 const struct HttpAddress *address = addr;
210 const char *ret; 210 const char *ret;
211 211
212 ret = http_common_plugin_address_to_string (NULL, 212 ret = http_common_plugin_address_to_string (type,
213 type,
214 address, 213 address,
215 addrlen); 214 addrlen);
216 asc (asc_cls, 215 asc (asc_cls,
@@ -265,15 +264,13 @@ http_common_plugin_address_to_url (void *cls,
265 * address and that the next call to this function is allowed 264 * address and that the next call to this function is allowed
266 * to override the address again. 265 * to override the address again.
267 * 266 *
268 * @param cls closure 267 * @param plugin the name of the plugin
269 * @param plugin the plugin
270 * @param addr binary address 268 * @param addr binary address
271 * @param addrlen length of the address 269 * @param addrlen length of the address
272 * @return string representing the same address 270 * @return string representing the same address
273 */ 271 */
274const char * 272const char *
275http_common_plugin_address_to_string (void *cls, 273http_common_plugin_address_to_string (const char *plugin,
276 const char *plugin,
277 const void *addr, 274 const void *addr,
278 size_t addrlen) 275 size_t addrlen)
279{ 276{
@@ -283,18 +280,20 @@ http_common_plugin_address_to_string (void *cls,
283 char *res; 280 char *res;
284 281
285 GNUNET_assert (NULL != plugin); 282 GNUNET_assert (NULL != plugin);
286
287 if (NULL == addr) 283 if (NULL == addr)
288 return NULL; 284 return NULL;
289 if (0 == addrlen) 285 if (0 == addrlen)
290 return TRANSPORT_SESSION_INBOUND_STRING; 286 return TRANSPORT_SESSION_INBOUND_STRING;
291 if (addrlen != http_common_address_get_size (address)) 287 if (addrlen != http_common_address_get_size (address))
292 return NULL; 288 return NULL;
293 addr_str = (char *) &address[1]; 289 addr_str = (char *) &address[1];
294
295 if (addr_str[ntohl(address->urlen) -1] != '\0') 290 if (addr_str[ntohl(address->urlen) -1] != '\0')
296 return NULL; 291 return NULL;
297 GNUNET_asprintf (&res, "%s.%u.%s", plugin, ntohl(address->options), &address[1]); 292 GNUNET_asprintf (&res,
293 "%s.%u.%s",
294 plugin,
295 ntohl (address->options),
296 &address[1]);
298 if (strlen(res) + 1 < 500) 297 if (strlen(res) + 1 < 500)
299 { 298 {
300 memcpy (rbuf, res, strlen(res) + 1); 299 memcpy (rbuf, res, strlen(res) + 1);