Skip to content

getTitle() only uses HTTPS; HTTP URLs break title fetching #20

@malladinagarjuna2

Description

@malladinagarjuna2

Description

When using neu appify <url> without the --title flag, the plugin fetches the page to extract its <title>. The getTitle() function only uses https.get(), so:

  • HTTP URLs (e.g. http://localhost:8080, http://localhost:3333, or any http:// site) fail when auto-fetching the title.
  • Users see: TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
  • Users are forced to pass --title for any HTTP URL.

Expected behavior

Title fetching should work for both http:// and https:// URLs so that neu appify http://localhost:3333 works without --title.

Steps to reproduce

  1. Install neu and add the appify plugin: neu plugins --add @neutralinojs/appify
  2. Serve a local site over HTTP, e.g. npx serve . -p 3333 in a folder with an index.html
  3. Run: neu appify http://localhost:3333 (without --title)
  4. Observe: ERR_INVALID_PROTOCOL instead of the app being created

Proposed fix

Parse the URL and use require('http') or https based on the URL protocol (e.g. via new URL(url).protocol or url.parse(url).protocol), so both http: and https: are supported in getTitle().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions