urlmon: Update existing session if user agent changes.

This commit is contained in:
Jacek Caban 2014-11-05 12:57:36 +01:00 committed by Alexandre Julliard
parent 552d9f3631
commit e385df0b8e
3 changed files with 9 additions and 1 deletions

View File

@ -302,6 +302,12 @@ HINTERNET get_internet_session(IInternetBindInfo *bind_info)
return internet_session; return internet_session;
} }
void update_user_agent(WCHAR *user_agent)
{
if(internet_session)
InternetSetOptionW(internet_session, INTERNET_OPTION_USER_AGENT, user_agent, strlenW(user_agent));
}
HRESULT protocol_start(Protocol *protocol, IInternetProtocol *prot, IUri *uri, HRESULT protocol_start(Protocol *protocol, IInternetProtocol *prot, IUri *uri,
IInternetProtocolSink *protocol_sink, IInternetBindInfo *bind_info) IInternetProtocolSink *protocol_sink, IInternetBindInfo *bind_info)
{ {

View File

@ -718,6 +718,7 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf
heap_free(user_agent); heap_free(user_agent);
user_agent = new_user_agent; user_agent = new_user_agent;
update_user_agent(user_agent);
LeaveCriticalSection(&session_cs); LeaveCriticalSection(&session_cs);
break; break;

View File

@ -72,7 +72,8 @@ IInternetProtocol *get_mime_filter(LPCWSTR) DECLSPEC_HIDDEN;
BOOL is_registered_protocol(LPCWSTR) DECLSPEC_HIDDEN; BOOL is_registered_protocol(LPCWSTR) DECLSPEC_HIDDEN;
HRESULT register_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL) DECLSPEC_HIDDEN; HRESULT register_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL) DECLSPEC_HIDDEN;
HINTERNET get_internet_session(IInternetBindInfo*) DECLSPEC_HIDDEN; HINTERNET get_internet_session(IInternetBindInfo*) DECLSPEC_HIDDEN;
LPWSTR get_useragent(void) DECLSPEC_HIDDEN; WCHAR *get_useragent(void) DECLSPEC_HIDDEN;
void update_user_agent(WCHAR*) DECLSPEC_HIDDEN;
void free_session(void) DECLSPEC_HIDDEN; void free_session(void) DECLSPEC_HIDDEN;
HRESULT bind_to_storage(IUri*,IBindCtx*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT bind_to_storage(IUri*,IBindCtx*,REFIID,void**) DECLSPEC_HIDDEN;