fix resolve host name issue
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@454 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
03d17809b7
commit
9f58705a39
@ -156,7 +156,7 @@ int http_resolve_address(struct sockaddr_in *server, const char * url, char *hos
|
|||||||
if (*url == ':')
|
if (*url == ':')
|
||||||
{
|
{
|
||||||
unsigned char w;
|
unsigned char w;
|
||||||
for (w = 0; w < 5 && url[w] != '/' && url[w] != '\0'; w ++)
|
for (w = 0; w < 5 && url[w + 1] != '/' && url[w + 1] != '\0'; w ++)
|
||||||
port[w] = url[w + 1];
|
port[w] = url[w + 1];
|
||||||
|
|
||||||
/* get port ok */
|
/* get port ok */
|
||||||
@ -165,6 +165,8 @@ int http_resolve_address(struct sockaddr_in *server, const char * url, char *hos
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((*url < '0' || *url > '9') && *url != '.')
|
||||||
|
is_domain = 1;
|
||||||
host_addr[i++] = *url;
|
host_addr[i++] = *url;
|
||||||
url ++;
|
url ++;
|
||||||
}
|
}
|
||||||
@ -395,9 +397,9 @@ static int shoutcast_connect(struct shoutcast_session* session,
|
|||||||
|
|
||||||
buf = rt_malloc (512);
|
buf = rt_malloc (512);
|
||||||
if (*url)
|
if (*url)
|
||||||
length = rt_snprintf(buf, 512, _shoutcast_get, url, host_addr, server->sin_port);
|
length = rt_snprintf(buf, 512, _shoutcast_get, url, host_addr, ntohs(server->sin_port));
|
||||||
else
|
else
|
||||||
length = rt_snprintf(buf, 512, _shoutcast_get, "/", host_addr, server->sin_port);
|
length = rt_snprintf(buf, 512, _shoutcast_get, "/", host_addr, ntohs(server->sin_port));
|
||||||
|
|
||||||
rc = send(peer_handle, buf, length, 0);
|
rc = send(peer_handle, buf, length, 0);
|
||||||
rt_kprintf("SHOUTCAST request:\n%s", buf);
|
rt_kprintf("SHOUTCAST request:\n%s", buf);
|
||||||
@ -511,6 +513,8 @@ struct shoutcast_session* shoutcast_session_open(char* url)
|
|||||||
return RT_NULL;
|
return RT_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rt_kprintf("connect to: %s...\n", host_addr);
|
||||||
|
|
||||||
// Now we connect and initiate the transfer by sending a
|
// Now we connect and initiate the transfer by sending a
|
||||||
// request header to the server, and receiving the response header
|
// request header to the server, and receiving the response header
|
||||||
if((peer_handle = shoutcast_connect(session, &server, host_addr, request)) < 0)
|
if((peer_handle = shoutcast_connect(session, &server, host_addr, request)) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user