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

Fixed status check #2032

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/common/http/filter/lua/lua_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ int StreamHandleWrapper::luaRespond(lua_State* state) {

uint64_t status;
if (headers->Status() == nullptr ||
!StringUtil::atoul(headers->Status()->value().c_str(), status) || status < 200 ||
status >= 500) {
!StringUtil::atoul(headers->Status()->value().c_str(), status) || status < 100 ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informational (1xx) status codes have special meaning and we should not allow a Lua script to send them, as they will confuse the connection manager, so that part was correct, but the error message below is wrong. But the other one was a bug. Thank you for fixing. We should have a test though. Do you mind changing one of the response tests to use a 5xx status code? If you don't want to bother I can fix this later today.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am leaving town this afternoon and will be off for a few days. Otherwise i would be able to fix it after i get back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way. If you would like to contribute we can wait, otherwise I'm happy to fix it. If you want to go that route just close the PR and I will do another PR later today.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add the fix, i would rather come back to it merged than wait

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status >= 600) {
luaL_error(state, ":status must be between 100-599");
}

Expand Down