#11 ✓wontfix
Jon Crosby

[PATCH] Rack::Lint::InputWrapper should delegate #string to the underlying IO object

Reported by Jon Crosby | December 28th, 2008 @ 10:41 PM

Rack::Lint::InputWrapper wraps StringIO but does not delegate the string method to the underlying object.

This patch adds support for the string method. The main benefit is that each piece of middleware does not have to rewind or check for the rewound state of the IO object.

http://github.com/jcrosby/rack/c...

Comments and changes to this ticket

  • Ryan Tomayko

    Ryan Tomayko December 29th, 2008 @ 10:37 AM

    How are you using this, Jon? I think the idea behind InputWrapper was to make the input be entirely Rack SPEC compliant so that when you're running in development with Rack::Lint you can surface code that calls non-SPEC methods on env["rack.input"].

    In other words, I think it's designed to fail if code tries to access a method that's not defined in the SPEC for The Input Stream, including #string. Here's the SPEC text:

    
    The input stream must respond to gets, each and read.
    
        * gets must be called without arguments and return a string, or nil on EOF.
        * read must be called without or with one integer argument and return a string, or nil on EOF.
        * each must be called without arguments and only yield Strings.
        * close must never be called on the input stream.
    

    If we want to add #string, we should amend the SPEC. No? Otherwise, middleware that accessed env["rack.input"].string would succeed with Rack::Lint present (development/test) but fail when Rack::Lint was not present (production).

  • chneukirchen (at gmail)

    chneukirchen (at gmail) January 4th, 2009 @ 10:28 PM

    • State changed from “new” to “wontfix”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Tags

Pages