Skip to content

Invalid or incomplete multibyte or wide character #225

@les-citrons

Description

@les-citrons

if you connect to a lua-http server and send it unix newlines (which I'm aware is invalid), it will throw with a somewhat cryptic error, rather than returning an error value or tolerating it.

reproduction:

local http_server = require "http.server"

local server = assert(http_server.listen {
	host = "127.0.0.1",
	port = 8080,
	onstream = function(server, stream)
		local headers = stream:get_headers()
		if headers then
			stream:write_body_from_string("hello, world!")
		end
	end,
})
assert(server:loop())
printf 'GET / HTTP/1.1\n\n' | nc localhost 8080
lua: repro.lua:13: /usr/local/share/lua/5.4/http/server.lua:182: get_next_incoming_stream: fill: Invalid or incomplete multibyte or wide character
stack traceback:
	[C]: in function 'assert'
	repro.lua:13: in main chunk
	[C]: in ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions