Jacek Caban : mshtml: Added IBindStatusCallback::OnResponse implementation.

Alexandre Julliard julliard at winehq.org
Wed Aug 12 11:08:49 CDT 2009


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Aug 11 19:15:07 2009 +0200

mshtml: Added IBindStatusCallback::OnResponse implementation.

---

 dlls/mshtml/mshtml_private.h |    1 +
 dlls/mshtml/navigate.c       |   26 ++++++++++++++++++++++++--
 dlls/mshtml/nsio.c           |    7 ++++++-
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 6ab70f2..6f72271 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -377,6 +377,7 @@ typedef struct {
     nsIURI *original_uri;
     char *content_type;
     char *charset;
+    PRUint32 response_status;
 } nsChannel;
 
 typedef struct {
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 8b1b27e..ad3abc5 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -58,6 +58,7 @@ typedef struct {
     HRESULT (*stop_binding)(BSCallback*,HRESULT);
     HRESULT (*read_data)(BSCallback*,IStream*);
     HRESULT (*on_progress)(BSCallback*,ULONG,LPCWSTR);
+    HRESULT (*on_response)(BSCallback*,DWORD);
 } BSCallbackVtbl;
 
 struct BSCallback {
@@ -473,9 +474,11 @@ static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD dwR
         LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
 {
     BSCallback *This = HTTPNEG_THIS(iface);
-    FIXME("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
+
+    TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
           debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
-    return E_NOTIMPL;
+
+    return This->vtbl->on_response(This, dwResponseCode);
 }
 
 static HRESULT WINAPI HttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface,
@@ -798,6 +801,11 @@ static HRESULT BufferBSC_on_progress(BSCallback *bsc, ULONG status_code, LPCWSTR
     return S_OK;
 }
 
+static HRESULT BufferBSC_on_response(BSCallback *bsc, DWORD response_code)
+{
+    return S_OK;
+}
+
 #undef BUFFERBSC_THIS
 
 static const BSCallbackVtbl BufferBSCVtbl = {
@@ -806,6 +814,7 @@ static const BSCallbackVtbl BufferBSCVtbl = {
     BufferBSC_stop_binding,
     BufferBSC_read_data,
     BufferBSC_on_progress,
+    BufferBSC_on_response
 };
 
 
@@ -887,6 +896,10 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
                && (BYTE)This->nsstream->buf[1] == 0xfe)
                 This->nschannel->charset = heap_strdupA(UTF16_STR);
 
+            /* FIXME: it's needed for http connections from BindToObject. */
+            if(!This->nschannel->response_status)
+                This->nschannel->response_status = 200;
+
             nsres = nsIStreamListener_OnStartRequest(This->nslistener,
                     (nsIRequest*)NSCHANNEL(This->nschannel), This->nscontext);
             if(NS_FAILED(nsres))
@@ -1009,6 +1022,14 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG status_code, LPCW
     return S_OK;
 }
 
+static HRESULT nsChannelBSC_on_response(BSCallback *bsc, DWORD response_code)
+{
+    nsChannelBSC *This = NSCHANNELBSC_THIS(bsc);
+
+    This->nschannel->response_status = response_code;
+    return S_OK;
+}
+
 #undef NSCHANNELBSC_THIS
 
 static const BSCallbackVtbl nsChannelBSCVtbl = {
@@ -1017,6 +1038,7 @@ static const BSCallbackVtbl nsChannelBSCVtbl = {
     nsChannelBSC_stop_binding,
     nsChannelBSC_read_data,
     nsChannelBSC_on_progress,
+    nsChannelBSC_on_response
 };
 
 nsChannelBSC *create_channelbsc(IMoniker *mon)
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index 7c402b2..087afdf 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -980,10 +980,15 @@ static nsresult NSAPI nsChannel_GetResponseStatus(nsIHttpChannel *iface, PRUint3
 
     TRACE("(%p)->(%p)\n", This, aResponseStatus);
 
+    if(This->response_status) {
+        *aResponseStatus = This->response_status;
+        return NS_OK;
+    }
+
     if(This->http_channel)
         return nsIHttpChannel_GetResponseStatus(This->http_channel, aResponseStatus);
 
-    return NS_ERROR_NOT_IMPLEMENTED;
+    return NS_ERROR_UNEXPECTED;
 }
 
 static nsresult NSAPI nsChannel_GetResponseStatusText(nsIHttpChannel *iface,




More information about the wine-cvs mailing list