From a506dc6f89ac3130e923e2ba34246bbed297eddc Mon Sep 17 00:00:00 2001 From: "heikki%netscape.com" Date: Thu, 24 Jan 2002 22:31:28 +0000 Subject: [PATCH] Bug 120615, XmlRpc does HTTP PUT when it should do POST. Patch from axel@pike.org. r=bbaetz@student.usyd.edu.au, sr=darin. git-svn-id: svn://10.0.0.236/trunk@112748 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/extensions/xml-rpc/src/nsXmlRpcClient.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mozilla/extensions/xml-rpc/src/nsXmlRpcClient.js b/mozilla/extensions/xml-rpc/src/nsXmlRpcClient.js index 25b515ca4b3..ca93052bc30 100644 --- a/mozilla/extensions/xml-rpc/src/nsXmlRpcClient.js +++ b/mozilla/extensions/xml-rpc/src/nsXmlRpcClient.js @@ -20,9 +20,9 @@ /* * nsXmlRpcClient XPCOM component - * Version: $Revision: 1.19 $ + * Version: $Revision: 1.20 $ * - * $Id: nsXmlRpcClient.js,v 1.19 2001-12-19 00:11:33 dougt%netscape.com Exp $ + * $Id: nsXmlRpcClient.js,v 1.20 2002-01-24 22:31:28 heikki%netscape.com Exp $ */ /* @@ -146,14 +146,8 @@ nsXmlRpcClient.prototype = { var chann = ioService.newChannelFromURI(this._serverUrl) .QueryInterface(Components.interfaces.nsIHttpChannel); - // Set the request method. - chann.requestMethod = 'POST'; - // Create a stream out of the request and attach it to the channel // Note: pending bug #37773, an extra \r\n needs to be added. - // and pending bug 112479, we have to set the headers manually. - chann.setRequestHeader('content-type', 'text/xml'); - chann.setRequestHeader('content-length', request.length); request = "\r\n" + request; var upload = chann.QueryInterface(Components.interfaces.nsIUploadChannel); var postStream = createInstance('@mozilla.org/io/string-input-stream;1', @@ -161,6 +155,10 @@ nsXmlRpcClient.prototype = { postStream.setData(request, request.length); upload.setUploadStream(postStream, 'text/xml', -1); + // Set the request method. setUploadStream guesses the method, + // so we gotta do this afterwards. + chann.requestMethod = 'POST'; + return chann; },