1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-05 13:59:01 -05:00
This commit is contained in:
Satya Rohith 2024-09-13 15:04:07 +05:30
parent d95db75de5
commit 95ad0faddb
No known key found for this signature in database
GPG key ID: B2705CF40523EB05
2 changed files with 17 additions and 15 deletions

View file

@ -535,20 +535,21 @@ Object.defineProperties(
return this._writeRaw(data, encoding, callback);
}
} else {
if (!this._listenerSet) {
this._listenerSet = true;
this.on("socket", (socket) => {
console.log("socket rid:", socket._handle.rid);
socket.on("ready", () => {
if (!this._headerSent && this._header !== null) {
this._writeHeader();
this._headerSent = true;
}
// if (!this._listenerSet) {
// this._listenerSet = true;
// this.on("socket", (socket) => {
// console.log("socket rid:", socket._handle.rid);
// socket.on("ready", () => {
// if (!this._headerSent && this._header !== null) {
// this._writeHeader();
// this._headerSent = true;
// }
this._flushBuffer();
});
});
}
// this._flushBuffer();
// });
// });
// }
console.log("pushing to outputData:", this.outputData.length);
this.outputData.push({ data, encoding, callback });
}
},
@ -596,7 +597,7 @@ Object.defineProperties(
encoding?: string | null,
callback?: () => void,
) {
console.log("_writeRaw invoked:", data.length);
console.trace("_writeRaw invoked:", data.length);
if (typeof data === "string") {
data = Buffer.from(data, encoding);
}

View file

@ -462,7 +462,7 @@ class ClientRequest extends OutgoingMessage {
(async () => {
try {
console.trace("js: sending request");
console.trace("js: sending request", this.socket.rid);
// console.log("this.socket", this.socket);
const [rid, connRid] = await op_node_http_request_with_conn(
this.method,
@ -608,6 +608,7 @@ class ClientRequest extends OutgoingMessage {
onSocket(socket, _err) {
nextTick(() => {
socket.on("connect", () => {
console.log("connect emitted");
// Flush the internal buffers once socket is ready.
// Note: the order is important, as the headers flush
// sets up the request.