mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1119280 - fix large spdy/h2 transfer truncation r=hurley
This commit is contained in:
parent
e3bb3e8a7a
commit
f0cb6227fd
@ -55,7 +55,7 @@ public:
|
||||
// as network specific items like cancels.
|
||||
bool SoftStreamError(nsresult code)
|
||||
{
|
||||
if (NS_SUCCEEDED(code)) {
|
||||
if (NS_SUCCEEDED(code) || code == NS_BASE_STREAM_WOULD_BLOCK) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -174,6 +174,27 @@ Http2BigListener.prototype.onStopRequest = function(request, ctx, status) {
|
||||
do_test_finished();
|
||||
};
|
||||
|
||||
var Http2HugeSuspendedListener = function() {};
|
||||
|
||||
Http2HugeSuspendedListener.prototype = new Http2CheckListener();
|
||||
Http2HugeSuspendedListener.prototype.count = 0;
|
||||
|
||||
Http2HugeSuspendedListener.prototype.onDataAvailable = function(request, ctx, stream, off, cnt) {
|
||||
this.onDataAvailableFired = true;
|
||||
this.isHttp2Connection = checkIsHttp2(request);
|
||||
this.count += cnt;
|
||||
read_stream(stream, cnt);
|
||||
};
|
||||
|
||||
Http2HugeSuspendedListener.prototype.onStopRequest = function(request, ctx, status) {
|
||||
do_check_true(this.onStartRequestFired);
|
||||
do_check_true(this.onDataAvailableFired);
|
||||
do_check_true(this.isHttp2Connection);
|
||||
do_check_eq(this.count, 1024 * 1024 * 1); // 1mb of data expected
|
||||
run_next_test();
|
||||
do_test_finished();
|
||||
};
|
||||
|
||||
// Does the appropriate checks for POSTs
|
||||
var Http2PostListener = function(expected_md5) {
|
||||
this.expected_md5 = expected_md5;
|
||||
@ -333,6 +354,14 @@ function test_http2_big() {
|
||||
chan.asyncOpen(listener, null);
|
||||
}
|
||||
|
||||
function test_http2_huge_suspended() {
|
||||
var chan = makeChan("https://localhost:6944/huge");
|
||||
var listener = new Http2HugeSuspendedListener();
|
||||
chan.asyncOpen(listener, null);
|
||||
chan.suspend();
|
||||
do_timeout(500, chan.resume);
|
||||
}
|
||||
|
||||
// Support for doing a POST
|
||||
function do_post(content, chan, listener) {
|
||||
var stream = Cc["@mozilla.org/io/string-input-stream;1"]
|
||||
@ -565,6 +594,7 @@ var tests = [ test_http2_post_big
|
||||
, test_http2_cookie_crumbling
|
||||
, test_http2_multiplex
|
||||
, test_http2_big
|
||||
, test_http2_huge_suspended
|
||||
, test_http2_post
|
||||
, test_http2_pushapi_1
|
||||
// These next two must always come in this order
|
||||
|
@ -227,6 +227,18 @@ function handleRequest(req, res) {
|
||||
res.setHeader("X-Expected-MD5", md5);
|
||||
}
|
||||
|
||||
else if (u.pathname === "/huge") {
|
||||
content = generateContent(1024);
|
||||
res.setHeader('Content-Type', 'text/plain');
|
||||
res.writeHead(200);
|
||||
// 1mb of data
|
||||
for (var i = 0; i < (1024 * 1); i++) {
|
||||
res.write(content); // 1kb chunk
|
||||
}
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (u.pathname === "/post") {
|
||||
if (req.method != "POST") {
|
||||
res.writeHead(405);
|
||||
|
Loading…
Reference in New Issue
Block a user