Jacek Caban : mshtml: Added nsIHttpChannel:: VisitResponseHeaders implementation.

Alexandre Julliard julliard at winehq.org
Sat Sep 18 07:42:24 CDT 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Sep 17 18:33:10 2010 +0200

mshtml: Added nsIHttpChannel::VisitResponseHeaders implementation.

---

 dlls/mshtml/nsiface.idl |   11 ++++++++++-
 dlls/mshtml/nsio.c      |   36 ++++++++++++++++++++++++++++++++++--
 2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index d4ab0b7..c7aaf88 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -107,7 +107,6 @@ interface nsISupports
 /* Currently we don't need a full declaration of these interfaces */
 typedef nsISupports nsISHistory;
 typedef nsISupports nsIWidget;
-typedef nsISupports nsIHttpHeaderVisitor;
 typedef nsISupports nsIDOMBarProp;
 typedef nsISupports nsIPrompt;
 typedef nsISupports nsIAuthPrompt;
@@ -430,6 +429,16 @@ interface nsIChannel : nsIRequest
 
 [
     object,
+    uuid(0cf40717-d7c1-4a94-8c1e-d6c9734101bb),
+    local
+]
+interface nsIHttpHeaderVisitor : nsISupports
+{
+    nsresult VisitHeader(const nsACString *aHeader, const nsACString *aValue);
+}
+
+[
+    object,
     uuid(9277fe09-f0cc-4cd9-bbce-581dd94b0260),
     local
 ]
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index 08d3c06..a157a4c 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -419,6 +419,38 @@ static nsresult set_channel_http_header(struct list *headers, const nsACString *
     return SUCCEEDED(hres) ? NS_OK : NS_ERROR_UNEXPECTED;
 }
 
+static nsresult visit_http_headers(struct list *headers, nsIHttpHeaderVisitor *visitor)
+{
+    nsACString header_str, value_str;
+    char *header, *value;
+    http_header_t *iter;
+    nsresult nsres;
+
+    LIST_FOR_EACH_ENTRY(iter, headers, http_header_t, entry) {
+        header = heap_strdupWtoA(iter->header);
+        if(!header)
+            return NS_ERROR_OUT_OF_MEMORY;
+
+        value = heap_strdupWtoA(iter->data);
+        if(!value) {
+            heap_free(header);
+            return NS_ERROR_OUT_OF_MEMORY;
+        }
+
+        nsACString_InitDepend(&header_str, header);
+        nsACString_InitDepend(&value_str, value);
+        nsres = nsIHttpHeaderVisitor_VisitHeader(visitor, &header_str, &value_str);
+        nsACString_Finish(&header_str);
+        nsACString_Finish(&value_str);
+        heap_free(header);
+        heap_free(value);
+        if(NS_FAILED(nsres))
+            break;
+    }
+
+    return NS_OK;
+}
+
 static void free_http_headers(struct list *list)
 {
     http_header_t *iter, *iter_next;
@@ -1211,9 +1243,9 @@ static nsresult NSAPI nsChannel_VisitResponseHeaders(nsIHttpChannel *iface,
 {
     nsChannel *This = NSCHANNEL_THIS(iface);
 
-    FIXME("(%p)->(%p)\n", This, aVisitor);
+    TRACE("(%p)->(%p)\n", This, aVisitor);
 
-    return NS_ERROR_NOT_IMPLEMENTED;
+    return visit_http_headers(&This->response_headers, aVisitor);
 }
 
 static nsresult NSAPI nsChannel_IsNoStoreResponse(nsIHttpChannel *iface, PRBool *_retval)




More information about the wine-cvs mailing list