Skip to content

Usage of electron.net.request triggers url.parse deprecation warning #49840

@xmedeko

Description

@xmedeko

Preflight Checklist

Electron Version

40.4.1

What operating system(s) are you using?

Windows

Operating System Version

Windows 11

What arch are you using?

x64

Last Known Working Electron version

39.6.0

Does the issue also appear in Chromium / Google Chrome?

No

Expected Behavior

Do not print any deprecation warning when using Electron APIs.

Actual Behavior

When creating request

const { net } = require('electron')
const r = net.request({
      method: 'POST',
      hostname: 'google.com',
      path: '/',
      port: NaN,
      protocol: 'https:'
  })

a deprecation warning is printed to the console:

(node:30768) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
    at Object.urlParse [as parse] (node:url:136:13)
    at parseOptions (node:electron/js2c/browser_init:2:130445)
    at new ClientRequest (node:electron/js2c/browser_init:2:131697)
    at Object.request (node:electron/js2c/browser_init:2:55979)
    at c:\...\net-request\main.js:27:15

Testcase Gist URL

https://gist.github.com/f831996440d9dfec51a7478f38234183

Additional Information

May be connected to #49550 ? (Seems to me it's a different problem.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    40-x-ybug 🪲component/nethas-repro-gistIssue can be reproduced with code at https://gist.github.com/platform/all

    Type

    Projects

    Status

    👍 Does Not Block Stable

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions