yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] yahns 1.4.0 - minor internal cleanups and bugfixes
@ 2014-11-16 11:13  5% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2014-11-16 11:13 UTC (permalink / raw)
  To: yahns-public

- http_client: clear some internal ivars on rack.hijack
- README: minor updates
- extras/autoindex: do not link beyond top-level
- extras/autoindex: fix misnamed variable
- extras/autoindex: integrate with TryGzipStatic
- queue: remove TODO comment for kqueue
- switch to require_relative for internal requires
- README: add OpenSSL exception
- stream_input: favor str.clear instead of str.replace('')
- http_response: skip Date header case-insensitively

* git clone git://yhbt.net/yahns
* http://yahns.yhbt.net/README
* http://yahns.yhbt.net/NEWS.atom.xml
* yahns-public@yhbt.net

^ permalink raw reply	[relevance 5%]

* [PATCH] extras/autoindex: do not link beyond top-level
@ 2014-09-01 22:48  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2014-09-01 22:48 UTC (permalink / raw)
  To: yahns-public; +Cc: Eric Wong

No need to waste space on this (and trigger "Bad partial
reference!" warnings on lynx)
---
 extras/autoindex.rb           | 2 ++
 test/test_extras_autoindex.rb | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/extras/autoindex.rb b/extras/autoindex.rb
index c8f7054..0ae7260 100644
--- a/extras/autoindex.rb
+++ b/extras/autoindex.rb
@@ -71,6 +71,8 @@ class Autoindex
         case base
         when "."
           next
+        when ".."
+          next if path_info == "/"
         end
 
         begin
diff --git a/test/test_extras_autoindex.rb b/test/test_extras_autoindex.rb
index ed0e1d5..e17234f 100644
--- a/test/test_extras_autoindex.rb
+++ b/test/test_extras_autoindex.rb
@@ -44,8 +44,12 @@ class TestExtrasAutoindex < Testcase
 
       res = http.request(Net::HTTP::Get.new("/"))
       assert_equal 200, res.code.to_i
+      refute_match %r{\.\./}, res.body, "top level should not link to parent"
       assert_match %r{foo}, res.body
-      assert_match %r{bar/}, res.body
+
+      res = http.request(Net::HTTP::Get.new("/bar/"))
+      assert_equal 200, res.code.to_i
+      assert_match %r{\.\./}, res.body, "link to parent present"
     end
   ensure
     quit_wait pid
-- 
EW


^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-09-01 22:48  7% [PATCH] extras/autoindex: do not link beyond top-level Eric Wong
2014-11-16 11:13  5% [ANN] yahns 1.4.0 - minor internal cleanups and bugfixes Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/yahns.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).