[ruby-cvs:68378] normal:r61197 (trunk): webrick: compile RE correctly for beginning and end match

normal at ruby-lang.org normal at ruby-lang.org
Wed Dec 13 09:38:08 JST 2017


normal	2017-12-13 09:38:08 +0900 (Wed, 13 Dec 2017)

  New Revision: 61197

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61197

  Log:
    webrick: compile RE correctly for beginning and end match
    
    Using ^ and $ in regexps means we can accidentally get fooled
    by "%0a" in HTTP request paths being decoded to newline
    characters.  Use \A and \z to match beginning and end-of-string
    respectively, instead.
    
    Thanks to mame and hsbt for reporting.
    
    * lib/webrick/httpserver.rb (MountTable#compile):
      use \A and \z instead of ^ and $
    * lib/webrick/httpserver.rb (MountTable#normalize): use \z instead of $
    * test/webrick/test_httpserver.rb (test_cntrl_in_path): new test

  Modified files:
    trunk/lib/webrick/httpserver.rb
    trunk/test/webrick/test_httpserver.rb


More information about the ruby-cvs mailing list