node-red: Can't make requests to Node-RED with nc since 3.0

Current Behavior

     echo -e "GET /usbip-attach/192.168.1.118/1-1 HTTP/1.1\n" | nc 192.168.1.254 1880
HTTP/1.1 400 Bad Request
Connection: close
Date: Sat, 10 Jun 2023 07:45:48 GMT
Transfer-Encoding: chunked

0

Expected Behavior

Success

Steps To Reproduce

See current behavior.

I make requests from a device with 4 MB ROM, so I can’t install full-featured http client like curl or wget.

Example flow

[
    {
        "id": "30f79fb83f339c9b",
        "type": "http in",
        "z": "bddb751fe2c7781a",
        "name": "",
        "url": "/usbip-attach/:ip/:busid",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 140,
        "y": 260,
        "wires": [
            [
                "0209019e3e06d412"
            ]
        ]
    },
    {
        "id": "0209019e3e06d412",
        "type": "function",
        "z": "bddb751fe2c7781a",
        "name": "",
        "func": "msg.payload = `-r ${msg.req.params.ip} -b ${msg.req.params.busid}`;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 340,
        "y": 260,
        "wires": [
            [
                "2c1ff0ddc2268206"
            ]
        ]
    },
    {
        "id": "2c1ff0ddc2268206",
        "type": "exec",
        "z": "bddb751fe2c7781a",
        "command": "sudo systemd-run usbip attach",
        "addpay": "payload",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 550,
        "y": 260,
        "wires": [
            [],
            [
                "0b2b57209ddbefeb"
            ],
            []
        ]
    },
    {
        "id": "0b2b57209ddbefeb",
        "type": "http response",
        "z": "bddb751fe2c7781a",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 750,
        "y": 260,
        "wires": []
    }
]

Environment

  • Node-RED version: 3.0.2
  • Node.js version: 20.2.0
  • npm version: 8.19.2
  • Platform/OS: Arch Linux
  • Browser: nc

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 27 (14 by maintainers)

Most upvoted comments

More likely NodeJS 20 (like 18) being more strict with HTTP headers out of the box