mshtml: Added nsIHttpChannel::VisitResponseHeaders implementation.

This commit is contained in:
Jacek Caban 2010-09-17 18:33:10 +02:00 committed by Alexandre Julliard
parent 19a0350bde
commit d4071b56a1
2 changed files with 44 additions and 3 deletions

View File

@ -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;
@ -428,6 +427,16 @@ interface nsIChannel : nsIRequest
nsresult AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext);
}
[
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),

View File

@ -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)