Added "Headers" support to a OAuth request, thus enabling the Picasa-Web plug-in to upload with a filename.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2232 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-11-03 20:10:30 +00:00
commit 7710db665c
2 changed files with 45 additions and 8 deletions

View file

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Xml;
using Greenshot.IniFile;
@ -64,7 +65,9 @@ namespace GreenshotPicasaPlugin {
IniConfig.Save();
}
try {
string response = oAuth.MakeOAuthRequest(HTTPMethod.POST, "https://picasaweb.google.com/data/feed/api/user/default/albumid/default", null, null, new ImageContainer(imageToUpload, outputSettings, filename));
IDictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("slug", OAuthSession.UrlEncode3986(filename));
string response = oAuth.MakeOAuthRequest(HTTPMethod.POST, "https://picasaweb.google.com/data/feed/api/user/default/albumid/default", headers, null, null, new ImageContainer(imageToUpload, outputSettings, filename));
return ParseResponse(response);
} catch (Exception ex) {
LOG.Error("Upload error: ", ex);