Skip to content

[BUG] Attempted to assign to readonly property. #969

@Tardis07

Description

@Tardis07

Environment Versions

  1. OS Type: Ubuntu 22.04.01 LTS
  2. Node version: node version unavailable. bun version 1.3.11
  3. http-server version: 14.1.1

Steps to reproduce

  1. bun install -g http-server
  2. http-server -d false -i
  3. curl http://localhost:8080

Expected result

Maybe 404? But at least capture the exception and keep serving the host.

Actual result

~# http-server -d false -i
Starting up http-server, serving ./

http-server version: 14.1.1

http-server settings: 
CORS: disabled
Cache: 3600 seconds
Connection Timeout: 120 seconds
Directory Listings: not visible
AutoIndex: not visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

<After curl the service>

48 | 
49 |   if (this.response) {
50 |     this._headers = this.response._headers = this.response._headers || {};
51 | 
52 |     // Patch to node core
53 |     this.response._headerNames = this.response._headerNames || {};
              ^
TypeError: Attempted to assign to readonly property.
      at <anonymous> (node:_http_outgoing:360:17)
      at new  (/root/.bun/install/global/node_modules/union/lib/response-stream.js:53:10)
      at new  (/root/.bun/install/global/node_modules/union/lib/routing-stream.js:30:17)
      at requestHandler (/root/.bun/install/global/node_modules/union/lib/core.js:27:25)
      at emit (node:events:98:22)
      at onNodeHTTPRequest (node:_http_server:367:22)
DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
 code: "DEP0066"

      at <anonymous> (internal:util/deprecate:9:30)
      at deprecated (internal:util/deprecate:20:29)
      at new  (/root/.bun/install/global/node_modules/union/lib/response-stream.js:50:51)
      at new  (/root/.bun/install/global/node_modules/union/lib/routing-stream.js:30:17)
      at requestHandler (/root/.bun/install/global/node_modules/union/lib/core.js:27:25)
      at emit (node:events:98:22)
      at onNodeHTTPRequest (node:_http_server:367:22)


Bun v1.3.11 (Linux x64)

After the error log, this process is self-terminated.

Other information

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