mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2025-06-08 12:35:30 +00:00
Improve proxy validation and debug traces
This commit is contained in:
parent
68fb96f0d8
commit
cd221bbbf1
@ -57,8 +57,12 @@ function buildExtraPrefsFirefox(proxy: Proxy): object {
|
|||||||
|
|
||||||
// proxy.url format => http://<host>:<port>
|
// proxy.url format => http://<host>:<port>
|
||||||
if (proxy && proxy.url) {
|
if (proxy && proxy.url) {
|
||||||
|
log.debug(`Using proxy: ${proxy.url}`)
|
||||||
const [host, portStr] = proxy.url.replace(/.+:\/\//g, '').split(':');
|
const [host, portStr] = proxy.url.replace(/.+:\/\//g, '').split(':');
|
||||||
const port = parseInt(portStr);
|
const port = parseInt(portStr);
|
||||||
|
if (!host || !portStr || !port) {
|
||||||
|
throw new Error("Proxy configuration is invalid! Use the format: protocol://ip:port")
|
||||||
|
}
|
||||||
|
|
||||||
const proxyPrefs = {
|
const proxyPrefs = {
|
||||||
"network.proxy.type": 1,
|
"network.proxy.type": 1,
|
||||||
@ -134,6 +138,8 @@ export async function testWebBrowserInstallation(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function create(session: string, options: SessionCreateOptions): Promise<SessionsCacheItem> {
|
export async function create(session: string, options: SessionCreateOptions): Promise<SessionsCacheItem> {
|
||||||
|
log.debug('Creating new session...')
|
||||||
|
|
||||||
const sessionId = session || UUIDv1()
|
const sessionId = session || UUIDv1()
|
||||||
|
|
||||||
// NOTE: cookies can't be set in the session, you need to open the page first
|
// NOTE: cookies can't be set in the session, you need to open the page first
|
||||||
|
Loading…
x
Reference in New Issue
Block a user