Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed2011-10-17 19:33:30 +0000
committerGrant Gayed2011-10-17 19:34:40 +0000
commit016dc8e9d43c2ce1a2b2df6c6d7ccc20e421936e (patch)
tree85a8f85c75b90eab41516ab12d0f078f5f75debe /bundles/org.eclipse.swt/Eclipse SWT WebKit
parent3d13668fc8f67ff4fa0a1a63646005afad14ca02 (diff)
downloadeclipse.platform.swt-016dc8e9d43c2ce1a2b2df6c6d7ccc20e421936e.tar.gz
eclipse.platform.swt-016dc8e9d43c2ce1a2b2df6c6d7ccc20e421936e.tar.xz
eclipse.platform.swt-016dc8e9d43c2ce1a2b2df6c6d7ccc20e421936e.zip
Bug 332259 - Post requests always uses
application/x-www-form-urlencoded content-type
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT WebKit')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
index 952c776dc1..c473e5299c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
@@ -39,8 +39,9 @@ class WebKit extends WebBrowser {
static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
static final String CHARSET_UTF8 = "UTF-8"; //$NON-NLS-1$
static final String CLASSNAME_EXTERNAL = "External"; //$NON-NLS-1$
- static final String ENCODING_FORM = "Content-Type: application/x-www-form-urlencoded"; //$NON-NLS-1$
static final String FUNCTIONNAME_CALLJAVA = "callJava"; //$NON-NLS-1$
+ static final String HEADER_CONTENTTYPE = "content-type"; //$NON-NLS-1$
+ static final String MIMETYPE_FORMURLENCODED = "application/x-www-form-urlencoded"; //$NON-NLS-1$
static final String OBJECTNAME_EXTERNAL = "external"; //$NON-NLS-1$
static final String PROPERTY_LENGTH = "length"; //$NON-NLS-1$
static final String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$
@@ -1748,10 +1749,23 @@ int /*long*/ webkit_resource_request_starting (int /*long*/ web_view, int /*long
WebKitGTK.soup_message_body_flatten (body);
if (headers == null) headers = new String[0];
- String[] temp = new String[headers.length + 1];
- System.arraycopy (headers, 0, temp, 0, headers.length);
- temp[headers.length] = ENCODING_FORM;
- headers = temp;
+ boolean found = false;
+ for (int i = 0; i < headers.length; i++) {
+ int index = headers[i].indexOf (':');
+ if (index != -1) {
+ String name = headers[i].substring (0, index).trim ().toLowerCase ();
+ if (name.equals (HEADER_CONTENTTYPE)) {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ String[] temp = new String[headers.length + 1];
+ System.arraycopy (headers, 0, temp, 0, headers.length);
+ temp[headers.length] = HEADER_CONTENTTYPE + ':' + MIMETYPE_FORMURLENCODED;
+ headers = temp;
+ }
postData = null;
}

Back to the top