Skip to content

Fix always-true redirect status check in HTTP handlers #47

Description

@SeanTAllen

Summary

The finished() method in both PaginatedJsonRequesterHandler and JsonRequesterHandler has a logic bug in the redirect status check:

elseif (_status != 301) or (_status != 307) then
  _receiver.failure(_status, consume y, "")
end

This condition is always true. If _status is 301, then _status != 307 is true. If _status is 307, then _status != 301 is true. For any other status, both sides are true.

The fix is and:

elseif (_status != 301) and (_status != 307) then

Locations

  • github_rest_api/paginated_list.pony:236
  • github_rest_api/request/http_get.pony:108

Impact

Likely masked in practice because apply() returns early on redirect responses with OneshotTransfer before finished() fires. But if a redirect arrived via chunked transfer, a spurious failure would be reported to the receiver alongside the legitimate redirect request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions