Commit 76598823 authored by Nikolas Zimmermann's avatar Nikolas Zimmermann Committed by Alexandre Julliard

Skip port number before calling gethostbyname.

Fix non-absolute urls.
parent f26d2522
......@@ -605,6 +605,15 @@ BOOL WINAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
if (NULL == lpwhr->lpszPath)
lpwhr->lpszPath = HTTP_strdup("/");
if(lpwhr->lpszPath[0] != '/') /* not an absolute path ?? --> fix it !! */
{
char *fixurl = HeapAlloc(GetProcessHeap(), 0, strlen(lpwhr->lpszPath) + 2);
*fixurl = '/';
strcpy(fixurl + 1, lpwhr->lpszPath);
HeapFree( GetProcessHeap(), 0, lpwhr->lpszPath );
lpwhr->lpszPath = fixurl;
}
/* Calculate length of request string */
requestStringLen =
strlen(lpwhr->lpszVerb) +
......
......@@ -113,9 +113,28 @@ time_t ConvertTimeString(LPCSTR asctime)
BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
struct hostent **phe, struct sockaddr_in *psa)
{
char *found;
TRACE("%s\n", lpszServerName);
*phe = gethostbyname(lpszServerName);
/* Validate server name first
* Check if there is sth. like
* pinger.macromedia.com:80
* if yes, eliminate the :80....
*/
found = strchr(lpszServerName, ':');
if (found)
{
int len = found - lpszServerName;
char *new = HeapAlloc(GetProcessHeap(), 0, len + 1);
memcpy( new, lpszServerName, len );
new[len] = '\0';
TRACE("Found a ':' inside the server name, reparsed name: %s\n", new);
*phe = gethostbyname(new);
HeapFree( GetProcessHeap(), 0, new );
}
else *phe = gethostbyname(lpszServerName);
if (NULL == *phe)
{
TRACE("Failed to get hostname: (%s)\n", lpszServerName);
......
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