Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

PSGI should allow the 0th array element to be a full HTTP status line #23

Open
tobyink opened this Issue · 5 comments

3 participants

@tobyink

For example:

[
    "500 Some specific error message",
    \@headers,
    \@body,
]
@miyagawa
Owner

This was discussed a lot when we initially designed PSGI and it was intentionally left out. (Python's WSGI supports this while Ruby's Rack doesn't)

@miyagawa
Owner

http://tozt.net/status-message.txt for reference from IRC chat.

Also https://groups.google.com/d/topic/rack-devel/KfNmEQpOZI0/discussion from Ruby's Rack point of view.

@miyagawa
Owner
14:57 miyagawa: it might be reasonable to make a breaking change on the server side for PSGI 1.2
14:59 miyagawa: like - the server appends the reason text only if the status code is only numeric
14:59 miyagawa: that way apps can check if PSGI is 1.2 (and maybe introduce new psgi.* variable to make sure) and in that case it *could* return "$code $reason"
14:59 miyagawa: apps can continue returning $code only, and it will work both 1.1 and 1.2
@tobyink

I had actually tried it with dualvar() but got caught up on Lint. Hadn't considered simply disabling Lint.

I'd really love it if this feature made it into the next version of PSGI. So far I've worked around it by setting an "X-" response header instead, but somebody else mentioned being frustrated by this limitation to me recently, so I decided it needed reporting as an issue.

@avar

Hopefully topical bikeshedding, but I think if this were to be
implemented making it either be an integer on a two-element ArrayRef
would make more sense. I.e. either:

[
    500,
    \@headers,
    \@body,
]

Or:

[
    [ 500, "Some specific error message" ]
    \@headers,
    \@body,
]

It would make it easier to e.g. check that the status code is valid on
the webserver layer without having to parse it out of a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.