Comparing version 4.0.0-rc.6 to 4.0.0-rc.7
@@ -382,2 +382,6 @@ 'use strict' | ||
wasm_on_message_begin: (p) => { | ||
assert.strictEqual(currentParser.ptr, p) | ||
return currentParser.onMessageBegin() || 0 | ||
}, | ||
wasm_on_header_field: (p, at, len) => { | ||
@@ -580,5 +584,3 @@ assert.strictEqual(currentParser.ptr, p) | ||
currentParser = this | ||
const ret = llhttp.exports.llhttp_finish(this.ptr) | ||
// TODO: ret == INVALID_EOF_STATE? | ||
assert(ret === constants.ERROR.OK || ret === constants.ERROR.INVALID_EOF_STATE) | ||
llhttp.exports.llhttp_finish(this.ptr) // TODO (fix): Check ret? | ||
} finally { | ||
@@ -590,2 +592,3 @@ currentParser = null | ||
} catch (err) { | ||
// TODO (fix): What if socket is already destroyed? Error will be swallowed. | ||
/* istanbul ignore next: difficult to make a test case for */ | ||
@@ -618,2 +621,16 @@ util.destroy(this.socket, err) | ||
onMessageBegin () { | ||
const { socket, client } = this | ||
/* istanbul ignore next: difficult to make a test case for */ | ||
if (socket.destroyed) { | ||
return -1 | ||
} | ||
const request = client[kQueue][client[kRunningIdx]] | ||
if (!request) { | ||
return -1 | ||
} | ||
} | ||
onHeaderField (buf) { | ||
@@ -726,3 +743,5 @@ const len = this.headers.length | ||
const request = client[kQueue][client[kRunningIdx]] | ||
assert(request) | ||
if (!request) { | ||
return -1 | ||
} | ||
@@ -807,2 +826,3 @@ // TODO: Check for content-length mismatch from server? | ||
util.destroy(socket, err) | ||
return -1 | ||
} | ||
@@ -848,2 +868,3 @@ | ||
util.destroy(socket, err) | ||
return -1 | ||
} | ||
@@ -913,8 +934,10 @@ } | ||
if (socket[kWriting]) { | ||
assert.strictEqual(client[kRunning], 0) | ||
// Response completed before request. | ||
util.destroy(socket, new InformationalError('reset')) | ||
// TODO: return -1? | ||
} else if (!this.shouldKeepAlive) { | ||
return constants.ERROR.PAUSED | ||
} else if (!shouldKeepAlive) { | ||
// TODO: What if running > 0? | ||
util.destroy(socket, new InformationalError('reset')) | ||
// TODO: return -1? | ||
return constants.ERROR.PAUSED | ||
} else if (socket[kReset] && client[kRunning] === 0) { | ||
@@ -926,3 +949,3 @@ // Destroy socket once all requests have completed. | ||
util.destroy(socket, new InformationalError('reset')) | ||
// TODO: return -1? | ||
return constants.ERROR.PAUSED | ||
} else { | ||
@@ -929,0 +952,0 @@ resume(client) |
@@ -167,3 +167,3 @@ 'use strict' | ||
this.code = code ? `HPE_${code}` : undefined | ||
this.data = data.toString() | ||
this.data = data ? data.toString() : undefined | ||
} | ||
@@ -170,0 +170,0 @@ } |
{ | ||
"name": "undici", | ||
"version": "4.0.0-rc.6", | ||
"version": "4.0.0-rc.7", | ||
"description": "An HTTP/1.1 client, written from scratch for Node.js", | ||
@@ -46,3 +46,4 @@ "homepage": "https://undici.nodejs.org", | ||
"serve:website": "docsify serve .", | ||
"prepare": "husky install" | ||
"prepare": "husky install", | ||
"fuzz": "jsfuzz test/fuzzing/fuzz.js corpus" | ||
}, | ||
@@ -59,2 +60,3 @@ "devDependencies": { | ||
"jest": "^26.6.3", | ||
"jsfuzz": "^1.0.15", | ||
"pre-commit": "^1.2.2", | ||
@@ -68,3 +70,3 @@ "proxy": "^1.0.2", | ||
"tap": "^15.0.9", | ||
"tsd": "^0.14.0", | ||
"tsd": "^0.17.0", | ||
"wait-on": "^5.3.0" | ||
@@ -71,0 +73,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
419921
4884
20