From a97ea2cf9ce5fbe768398d6a341f144c5541f6c3 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Wed, 27 Oct 2021 15:05:45 +0530 Subject: [PATCH] Proxy fixed --- play-dl/Request/classes.ts | 2 +- play-dl/Request/index.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/play-dl/Request/classes.ts b/play-dl/Request/classes.ts index 5644319..423e434 100644 --- a/play-dl/Request/classes.ts +++ b/play-dl/Request/classes.ts @@ -42,7 +42,7 @@ export class Proxy { private onConnect() { this.socket.write( `${this.options.method} ${this.parsed_url.pathname}${this.parsed_url.search} HTTP/1.1\r\n` + - `Host : ${this.parsed_url.hostname}\r\n` + + `Host: ${this.parsed_url.hostname}\r\n` + this.sentHeaders + `Connection: close\r\n` + `\r\n` diff --git a/play-dl/Request/index.ts b/play-dl/Request/index.ts index 66a528c..381bc81 100644 --- a/play-dl/Request/index.ts +++ b/play-dl/Request/index.ts @@ -151,9 +151,13 @@ function proxy_getter(req_url: string, req_proxy: ProxyOptions[], headers?: Obje password: parsed.password } }; - } else opts = proxy; + } else + opts = { + host: proxy.host, + port: Number(proxy.port) + }; let req: ClientRequest; - if (opts.authentication?.username.length === 0) { + if (!opts.authentication) { req = http.request({ host: opts.host, port: opts.port,