Commit bdbb3412 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Don't add brackets around IPv6 addresses, this is annoying

parent 10f6eaea
...@@ -1329,26 +1329,17 @@ void httpd_ClientModeBidir( httpd_client_t *cl ) ...@@ -1329,26 +1329,17 @@ void httpd_ClientModeBidir( httpd_client_t *cl )
char* httpd_ClientIP( httpd_client_t *cl ) char* httpd_ClientIP( httpd_client_t *cl )
{ {
int i; int i;
char sz_ip[NI_MAXNUMERICHOST + 2]; char *psz_ip = malloc( NI_MAXNUMERICHOST );
i = vlc_getnameinfo( (const struct sockaddr *)&cl->sock, cl->i_sock_size, if( psz_ip == NULL )
sz_ip+1, NI_MAXNUMERICHOST, NULL, NI_NUMERICHOST );
if( i != 0 )
return NULL; return NULL;
/* semi-colon in address => must add bracket for HTTP */ i = vlc_getnameinfo( (const struct sockaddr *)&cl->sock, cl->i_sock_size,
if( strchr( sz_ip + 1, ':' ) != NULL ) psz_ip, NI_MAXNUMERICHOST, NULL, NI_NUMERICHOST );
{ if( i )
sz_ip[0] = '['; return NULL;
i = strlen( sz_ip );
sz_ip[i++] = ']';
sz_ip[i] = '\0';
return strdup(sz_ip);
}
return strdup(sz_ip + 1); return psz_ip;
} }
static void httpd_ClientClean( httpd_client_t *cl ) static void httpd_ClientClean( httpd_client_t *cl )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment