Skip to content

lost port numbers #3

@md97212

Description

@md97212

When not running on port 80 we encountered a problem where the port number (ex: 8080) was getting dropped and therefore suggest some thing like:

   const path = decodeURIComponent(pathname);

   await new Promise((resolve, reject) => {
       const req = http.request({
           method: 'HEAD',
           port: port,
           host: hostname,
           path,
       }, ({statusCode, headers}) => {```
instead of 
const {origin, hostname, pathname, searchParams} = new URL(url);
const path = decodeURIComponent(pathname);

await new Promise((resolve, reject) => {
    const req = http.request({
        method: 'HEAD',
        host: hostname,
        path,
    }, ({statusCode, headers}) => {
        if (!headers || (statusCode == 200 && !/text\/html/i.test(headers['content-type']))) {
    reject(new Error('Not a HTML page'));```

ironically, I don't have easy access to port 80 so haven't tested this much yet, but thought I would raise the issue.

cheers,
Mark

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions