1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-03 17:08:35 -05:00
This commit is contained in:
Yoshiya Hinosawa 2024-09-24 20:28:50 +09:00
parent 65eb113359
commit be8c90de6f
No known key found for this signature in database
GPG key ID: 9017DB4559488785
2 changed files with 37 additions and 32 deletions

View file

@ -497,15 +497,15 @@ Object.defineProperties(
const socket = this.socket; const socket = this.socket;
const outputLength = this.outputData.length; const outputLength = this.outputData.length;
if (socket && outputLength > 0) { if (socket && outputLength > 0) {
const { data, encoding, callback } = this.outputData.shift(); const { data, encoding, callback } = this.outputData.shift();
console.log("flushBody: writing", { data }); console.log("flushBody: writing", { data });
this._writeRaw(data, encoding, callback); this._writeRaw(data, encoding, callback);
if (this.outputData.length > 0) { if (this.outputData.length > 0) {
this.on("drain", () => { this.on("drain", () => {
console.log("drain emitted"); console.log("drain emitted");
this._flushBody(); this._flushBody();
}); });
} }
} }
}, },
@ -514,7 +514,10 @@ Object.defineProperties(
_flushHeaders() { _flushHeaders() {
console.log("flushHeaders"); console.log("flushHeaders");
if (this.socket) { if (this.socket) {
console.log("socket found: ", { headerSent: this._headerSent, header: this._header }); console.log("socket found: ", {
headerSent: this._headerSent,
header: this._header,
});
if (!this._headerSent) { if (!this._headerSent) {
console.log("_writeHeader invoked"); console.log("_writeHeader invoked");
this._writeHeader(); this._writeHeader();

View file

@ -617,15 +617,15 @@ class ClientRequest extends OutgoingMessage {
// Flush the internal buffers once socket is ready. // Flush the internal buffers once socket is ready.
// Note: the order is important, as the headers flush // Note: the order is important, as the headers flush
// sets up the request. // sets up the request.
try { try {
this._flushHeaders(); this._flushHeaders();
this.on("requestReady", () => { this.on("requestReady", () => {
console.log("onSocket: flushing body"); console.log("onSocket: flushing body");
this._flushBody(); this._flushBody();
}); });
} catch (error) { } catch (error) {
console.log("socket error: ", error); console.log("socket error: ", error);
} }
}); });
this.socket = socket; this.socket = socket;
this.emit("socket", socket); this.emit("socket", socket);
@ -801,19 +801,21 @@ class ClientRequest extends OutgoingMessage {
path = "/" + path; path = "/" + path;
} }
console.log("_createUrlStrFromOptions 9"); console.log("_createUrlStrFromOptions 9");
// try { // try {
console.log({ url: `${protocol}//${auth ? `${auth}@` : ""}${host}${ console.log({
port === 80 ? "" : `:${port}` url: `${protocol}//${auth ? `${auth}@` : ""}${host}${
}${path}` }) port === 80 ? "" : `:${port}`
const url = new URL( }${path}`,
`${protocol}//${auth ? `${auth}@` : ""}${host}${ });
port === 80 ? "" : `:${port}` const url = new URL(
}${path}`, `${protocol}//${auth ? `${auth}@` : ""}${host}${
); port === 80 ? "" : `:${port}`
console.log(url); }${path}`,
// } catch (error) { );
// console.log({ error }) console.log(url);
// } // } catch (error) {
// console.log({ error })
// }
console.log("_createUrlStrFromOptions 10"); console.log("_createUrlStrFromOptions 10");
url.hash = hash; url.hash = hash;
console.log("_createUrlStrFromOptions end"); console.log("_createUrlStrFromOptions end");