Escape any spaces in lpszObjectName passed to HttpOpenRequest.

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 784912a..a3bac3a 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -15,6 +15,7 @@
 #include "debugtools.h"
 #include "winerror.h"
 #include "winsock.h"
+#include "shlwapi.h"
 
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
@@ -222,8 +223,13 @@
     lpwhr->hdr.dwContext = dwContext;
     lpwhr->nSocketFD = INVALID_SOCKET;
 
-    if (NULL != lpszObjectName && strlen(lpszObjectName))
-    	lpwhr->lpszPath = HTTP_strdup(lpszObjectName);
+    if (NULL != lpszObjectName && strlen(lpszObjectName)) {
+        DWORD needed = 0;
+        UrlEscapeA(lpszObjectName, NULL, &needed, URL_ESCAPE_SPACES_ONLY);
+        lpwhr->lpszPath = HeapAlloc(GetProcessHeap(), 0, needed);
+        UrlEscapeA(lpszObjectName, lpwhr->lpszPath, &needed,
+                   URL_ESCAPE_SPACES_ONLY);
+    }
 
     if (NULL != lpszReferrer && strlen(lpszReferrer))
         HTTP_ProcessHeader(lpwhr, HTTP_REFERER, lpszReferrer, HTTP_ADDHDR_FLAG_COALESCE);