Module: wine Branch: master Commit: 0085383fc765fb10624de4423df074b404bae099 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0085383fc765fb10624de4423d...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Aug 3 21:40:20 2010 +0200
mshtml: Store request method in nsChannel.
---
dlls/mshtml/mshtml_private.h | 8 ++++++++ dlls/mshtml/nsio.c | 21 ++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index fcdb792..1e7bac8 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -446,6 +446,13 @@ typedef struct nsWineURI nsWineURI; HRESULT set_wine_url(nsWineURI*,LPCWSTR); nsresult on_start_uri_open(NSContainer*,nsIURI*,PRBool*);
+/* Keep sync with request_method_strings in nsio.c */ +typedef enum { + METHOD_GET, + METHOD_PUT, + METHOD_POST +} REQUEST_METHOD; + typedef struct { const nsIHttpChannelVtbl *lpHttpChannelVtbl; const nsIUploadChannelVtbl *lpUploadChannelVtbl; @@ -463,6 +470,7 @@ typedef struct { char *content_type; char *charset; PRUint32 response_status; + REQUEST_METHOD request_method; struct list response_headers; struct list request_headers; UINT url_scheme; diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 24b14c3..db6b9eb 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 Jacek Caban for CodeWeavers + * Copyright 2006-2010 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -51,6 +51,8 @@ static nsINetUtil *net_util;
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
+static const char *request_method_strings[] = {"GET", "PUT", "POST"}; + struct nsWineURI { const nsIURLVtbl *lpIURLVtbl;
@@ -1048,10 +1050,21 @@ static nsresult NSAPI nsChannel_SetRequestMethod(nsIHttpChannel *iface, const nsACString *aRequestMethod) { nsChannel *This = NSCHANNEL_THIS(iface); + const char *method; + unsigned i;
- TRACE("(%p)->(%s): Returning NS_OK\n", This, debugstr_nsacstr(aRequestMethod)); + TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aRequestMethod));
- return NS_OK; + nsACString_GetData(aRequestMethod, &method); + for(i=0; i < sizeof(request_method_strings)/sizeof(*request_method_strings); i++) { + if(!strcasecmp(method, request_method_strings[i])) { + This->request_method = i; + return NS_OK; + } + } + + ERR("Invalid method %s\n", debugstr_a(method)); + return NS_ERROR_UNEXPECTED; }
static nsresult NSAPI nsChannel_GetReferrer(nsIHttpChannel *iface, nsIURI **aReferrer) @@ -1329,6 +1342,7 @@ static nsresult NSAPI nsUploadChannel_SetUploadStream(nsIUploadChannel *iface, if(aStream) nsIInputStream_AddRef(aStream);
+ This->request_method = METHOD_POST; return NS_OK; }
@@ -2640,6 +2654,7 @@ static nsresult NSAPI nsIOService_NewChannelFromURI(nsIIOService *iface, nsIURI ret->lpIHttpChannelInternalVtbl = &nsHttpChannelInternalVtbl; ret->ref = 1; ret->uri = wine_uri; + ret->request_method = METHOD_GET; list_init(&ret->response_headers); list_init(&ret->request_headers);