Skip to content

inets/httpd#c:do/1 nobody throws 500 internal server error. #10501

@Green0wl

Description

@Green0wl

Describe the bug

Body :: iolist() | nobody | {Fun, FunArg},
says, nobody atom is a possible value for Body. Despite this fact, an 500 Internal Server Error occurs and body consists of fallback HTML.

To Reproduce

-module(my_mod).
-export([do/1]).

do(_) ->
    {break, [{response, {401, nobody}}]}.
-module(a).

-behaviour(application).

-export([start/2, stop/1]).

start(_, _) ->
    inets:start(),
    {ok, Pid} =
        inets:start(
            httpd,
            [
                {port, 8080},
                {server_root, "."},
                {document_root, "."},
                {bind_address, "localhost"},
                {modules, [
                    mod_alias,
                    mod_auth,
                    my_mod,
                    mod_esi,
                    mod_actions,
                    mod_cgi,
                    mod_get,
                    mod_head,
                    mod_log,
                    mod_disk_log
                ]}
            ]
        ),
    {ok, Pid}.

stop(Server) ->
    ok = inets:stop(httpd, Server).

And start with:

erlc a.erl my_mod.erl && erl -noinput -eval 'a:start(0, 0).'

Expected behavior
A response with status code 401 and empty body is sent back.

Affected versions
Erlang/OTP 28 [erts-16.1.1].

Additional context
No additional context.

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:PSAssigned to OTP team PS

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions