@ossiana/node-libcurl
Advanced tools
Comparing version 1.4.11 to 1.4.12
@@ -365,3 +365,3 @@ "use strict"; | ||
for (const [key, value] of this.m_requestHeaders_.entries()) { | ||
this.m_libCurl_impl_.setRequestHeader(key, value); | ||
this.m_libCurl_impl_.setRequestHeader(key.at(-1) == ":" ? key.slice(0, -1) : key, value); | ||
} | ||
@@ -420,3 +420,3 @@ this.m_requestHeaders_ = new Headers(); | ||
for (const [key, value] of this.m_requestHeaders_.entries()) { | ||
const _key = key.toLowerCase(); | ||
const _key = (key.at(-1) == ":" ? key.slice(0, -1) : key).toLowerCase(); | ||
let _; | ||
@@ -423,0 +423,0 @@ if ((_ = fixedPrefixArr.find((e) => e.toLowerCase() == _key))) { |
@@ -7,2 +7,3 @@ import { LibCurl, LibCurlJA3FingerPrintInfo, LibCurlURLInfo } from "./libcurl"; | ||
cookie?: string; | ||
protocol?: string; | ||
timeout?: number; | ||
@@ -9,0 +10,0 @@ ja3?: LibCurlJA3FingerPrintInfo; |
@@ -16,13 +16,17 @@ "use strict"; | ||
const curl = option.instance || new libcurl_1.LibCurl(); | ||
const headers = ["Accept:", "Accept-Encoding:"]; | ||
const impl = curl.m_libCurl_impl_; | ||
impl.setRequestHeader("Accept", ""); | ||
impl.setRequestHeader("Accept-Encoding", ""); | ||
if (option.cookie) { | ||
headers.push("Cookie: " + option.cookie); | ||
impl.setRequestHeader("Cookie", option.cookie); | ||
} | ||
if (option.origin) { | ||
headers.push("Origin: " + option.origin); | ||
impl.setRequestHeader("Origin", option.origin); | ||
} | ||
if (option.userAgent) { | ||
headers.push("User-Agent: " + option.userAgent); | ||
impl.setRequestHeader("User-Agent", option.userAgent); | ||
} | ||
curl.setRequestHeaders(headers.join("\n")); | ||
if (option.protocol) { | ||
impl.setRequestHeader("Sec-WebSocket-Protocol", option.protocol); | ||
} | ||
if (option.timeout) { | ||
@@ -41,3 +45,3 @@ curl.setTimeout(option.timeout, option.timeout); | ||
catch (error) { | ||
console.error('LibCurlWebSocket onOpen catch a error', error); | ||
console.error("LibCurlWebSocket onOpen catch a error", error); | ||
} | ||
@@ -51,3 +55,3 @@ }); | ||
catch (error) { | ||
console.error('LibCurlWebSocket onClose catch a error', error); | ||
console.error("LibCurlWebSocket onClose catch a error", error); | ||
} | ||
@@ -60,3 +64,3 @@ }); | ||
catch (error) { | ||
console.error('LibCurlWebSocket onMessage catch a error', error); | ||
console.error("LibCurlWebSocket onMessage catch a error", error); | ||
} | ||
@@ -69,3 +73,3 @@ }); | ||
catch (error) { | ||
console.error('LibCurlWebSocket onError catch a error', error); | ||
console.error("LibCurlWebSocket onError catch a error", error); | ||
} | ||
@@ -72,0 +76,0 @@ }); |
{ | ||
"name": "@ossiana/node-libcurl", | ||
"version": "1.4.11", | ||
"version": "1.4.12", | ||
"author": { | ||
@@ -32,6 +32,6 @@ "name": "Ossian" | ||
"optionalDependencies": { | ||
"@ossiana/node-libcurl-darwin-x64": "1.4.11", | ||
"@ossiana/node-libcurl-darwin-arm64": "1.4.11", | ||
"@ossiana/node-libcurl-linux-x64-gnu": "1.4.11", | ||
"@ossiana/node-libcurl-win32-x64-msvc": "1.4.11" | ||
"@ossiana/node-libcurl-darwin-x64": "1.4.12", | ||
"@ossiana/node-libcurl-darwin-arm64": "1.4.12", | ||
"@ossiana/node-libcurl-linux-x64-gnu": "1.4.12", | ||
"@ossiana/node-libcurl-win32-x64-msvc": "1.4.12" | ||
}, | ||
@@ -52,3 +52,3 @@ "main": "./dist/index.js", | ||
}, | ||
"artifacts-version": "v1.0.1" | ||
"artifacts-version": "v1.0.2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
113163
1773