Jacek Caban : mshtml: Try using IWinInetHttpInfo if OnResponse was not called.

Alexandre Julliard julliard at winehq.org
Thu Sep 13 14:39:21 CDT 2012


Module: wine
Branch: master
Commit: a9829338694b27c893109070d0be8f4462a58961
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a9829338694b27c893109070d0be8f4462a58961

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Sep 13 12:29:30 2012 +0200

mshtml: Try using IWinInetHttpInfo if OnResponse was not called.

---

 dlls/mshtml/binding.h  |    1 +
 dlls/mshtml/navigate.c |   41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/dlls/mshtml/binding.h b/dlls/mshtml/binding.h
index eef6053..0053e75 100644
--- a/dlls/mshtml/binding.h
+++ b/dlls/mshtml/binding.h
@@ -87,6 +87,7 @@ struct nsChannelBSC {
     nsISupports *nscontext;
     BOOL is_js;
     BOOL is_doc_channel;
+    BOOL response_processed;
 
     nsProtocolStream *nsstream;
 };
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 1046356..4bed605 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -754,6 +754,33 @@ static HRESULT process_response_headers(nsChannelBSC *This, const WCHAR *headers
     return S_OK;
 }
 
+static void query_http_info(nsChannelBSC *This, IWinInetHttpInfo *wininet_info)
+{
+    const WCHAR *ptr;
+    DWORD len = 0;
+    WCHAR *buf;
+
+    IWinInetHttpInfo_QueryInfo(wininet_info, HTTP_QUERY_RAW_HEADERS_CRLF, NULL, &len, NULL, NULL);
+    if(!len)
+        return;
+
+    buf = heap_alloc(len);
+    if(!buf)
+        return;
+
+    IWinInetHttpInfo_QueryInfo(wininet_info, HTTP_QUERY_RAW_HEADERS_CRLF, buf, &len, NULL, NULL);
+    if(!len)
+        return;
+
+    ptr = strchrW(buf, '\r');
+    if(ptr && ptr[1] == '\n') {
+        ptr += 2;
+        process_response_headers(This, ptr);
+    }
+
+    heap_free(buf);
+}
+
 HRESULT start_binding(HTMLInnerWindow *inner_window, BSCallback *bscallback, IBindCtx *bctx)
 {
     IStream *str = NULL;
@@ -1111,6 +1138,19 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
     nsresult nsres;
     HRESULT hres;
 
+    if(!This->response_processed) {
+        IWinInetHttpInfo *wininet_info;
+
+        This->response_processed = TRUE;
+        if(This->bsc.binding) {
+            hres = IBinding_QueryInterface(This->bsc.binding, &IID_IWinInetHttpInfo, (void**)&wininet_info);
+            if(SUCCEEDED(hres)) {
+                query_http_info(This, wininet_info);
+                IWinInetHttpInfo_Release(wininet_info);
+            }
+        }
+    }
+
     if(!This->nslistener) {
         BYTE buf[1024];
 
@@ -1601,6 +1641,7 @@ static HRESULT nsChannelBSC_on_response(BSCallback *bsc, DWORD response_code,
     nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
     HRESULT hres;
 
+    This->response_processed = TRUE;
     This->nschannel->response_status = response_code;
 
     if(response_headers) {




More information about the wine-cvs mailing list