Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tobyink opened this issue Jul 23, 2012 · 5 comments
Open

Comments

@tobyink
Copy link

tobyink commented Jul 23, 2012

For example:

[
    "500 Some specific error message",
    \@headers,
    \@body,
]
@miyagawa
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Author

tobyink commented Jul 24, 2012

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
Copy link
Contributor

avar commented Sep 12, 2012

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants