nameUpper.startsWith(QLatin1String("SEC-")))
return v8::Undefined();
- r->addHeader(nameUpper, value);
+ r->addHeader(name, value);
return v8::Undefined();
}
PUT /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Content-Type: text/plain;charset=UTF-8
Content-Length: 9
Connection: Keep-Alive
GET /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0
GET /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0
POST /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Content-Type: text/plain;charset=UTF-8
Content-Length: 12
Connection: Keep-Alive
POST /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Content-Type: charset=UTF-8;text/plain
Content-Length: 12
Connection: Keep-Alive
PUT /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Content-Type: text/plain;charset=UTF-8
Content-Length: 12
Connection: Keep-Alive
DELETE /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0
GET /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0
HEAD /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0
GET /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
-TEST-HEADER: value
-TEST-HEADER2: value,value2
+Accept-Language: en-US
+Test-header: value
+Test-header2: value,value2
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0
--- /dev/null
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language","en-US");
+
+ x.setRequestHeader("Test-header", "value");
+ //Setting headers with just different cases
+ //will be treated as the same header, and accepted
+ //as the last setting.
+ x.setRequestHeader("Test-hEADEr2", "value");
+ x.setRequestHeader("Test-header2", "value2");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send();
+ }
+}
GET /testdocument.html HTTP/1.1
-ACCEPT-LANGUAGE: en-US
+Accept-Language: en-US
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0
void open_sync();
void open_arg_count();
void setRequestHeader();
+ void setRequestHeader_caseInsensitive();
void setRequestHeader_unsent();
void setRequestHeader_illegalName_data();
void setRequestHeader_illegalName();
delete object;
}
+// Test valid setRequestHeader() calls with different header cases
+void tst_qdeclarativexmlhttprequest::setRequestHeader_caseInsensitive()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(TEST_FILE("setRequestHeader.expect"),
+ TEST_FILE("setRequestHeader.reply"),
+ TEST_FILE("testdocument.html")));
+
+ QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_caseInsensitive.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
// Test setting headers before open() throws exception
void tst_qdeclarativexmlhttprequest::setRequestHeader_unsent()
{