1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-06 22:35:51 -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); return this._writeRaw(data, encoding, callback);
} }
} else { } else {
if (!this._listenerSet) { // if (!this._listenerSet) {
this._listenerSet = true; // this._listenerSet = true;
this.on("socket", (socket) => { // this.on("socket", (socket) => {
console.log("socket rid:", socket._handle.rid); // console.log("socket rid:", socket._handle.rid);
socket.on("ready", () => { // socket.on("ready", () => {
if (!this._headerSent && this._header !== null) { // if (!this._headerSent && this._header !== null) {
this._writeHeader(); // this._writeHeader();
this._headerSent = true; // this._headerSent = true;
} // }
this._flushBuffer(); // this._flushBuffer();
}); // });
}); // });
} // }
console.log("pushing to outputData:", this.outputData.length);
this.outputData.push({ data, encoding, callback }); this.outputData.push({ data, encoding, callback });
} }
}, },
@ -596,7 +597,7 @@ Object.defineProperties(
encoding?: string | null, encoding?: string | null,
callback?: () => void, callback?: () => void,
) { ) {
console.log("_writeRaw invoked:", data.length); console.trace("_writeRaw invoked:", data.length);
if (typeof data === "string") { if (typeof data === "string") {
data = Buffer.from(data, encoding); data = Buffer.from(data, encoding);
} }

View file

@ -462,7 +462,7 @@ class ClientRequest extends OutgoingMessage {
(async () => { (async () => {
try { try {
console.trace("js: sending request"); console.trace("js: sending request", this.socket.rid);
// console.log("this.socket", this.socket); // console.log("this.socket", this.socket);
const [rid, connRid] = await op_node_http_request_with_conn( const [rid, connRid] = await op_node_http_request_with_conn(
this.method, this.method,
@ -608,6 +608,7 @@ class ClientRequest extends OutgoingMessage {
onSocket(socket, _err) { onSocket(socket, _err) {
nextTick(() => { nextTick(() => {
socket.on("connect", () => { socket.on("connect", () => {
console.log("connect emitted");
// 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.