[#39804] CGIでのリダイレクションの書き方 — Yoichiro Takehora <yoichiro@...>
こんにちは、竹洞です。
7 messages
2004/07/02
[#39811] keyword-argument-like argument passing via Hash — NISHIMATSU Takeshi <t-nissie@...>
西松と申します.
4 messages
2004/07/02
[#39814] Socket:IPヘッダの編集方法 — takeshi honda <moecho21@...>
本田と申します。
6 messages
2004/07/02
[#39819] [ANN] Ruby-GetText-Package-0.6.0 — Masao Mutoh <mutoh@...>
むとうです。
4 messages
2004/07/04
[#39822] (要素がString, Fixnum 以外の)配列の集合演算 — Hiroshi Takagi <gollum@...>
高木といいます、よろしく。
11 messages
2004/07/05
[#39823] Re: (要素がString, Fixnum 以外の)配列の集合演算
— 卜部昌平 <s-urabe@...>
2004/07/05
mput です。
[#39824] Re: (要素がString, Fixnum 以外の)配列の集合演算
— Hiroshi Takagi <gollum@...>
2004/07/05
高木です。
[#39826] Re: (要素がString, Fixnum 以外の)配列の集合演算
— nobu.nakada@...
2004/07/06
なかだです。
[#39856] 直接関係のない配列の有無が、ある配列の値に影響する不具合 — "Hisashi Yahata" <yahatah@...>
5 messages
2004/07/17
[#39863] forループの速度 — Masahiro Sato <msato@...>
15 messages
2004/07/20
[#39868] イテレータとfor文 — OOTANI TAKASHI <otn@...5.so-net.ne.jp>
大谷と申します。
31 messages
2004/07/20
[#39870] Re: イテレータとfor文
— Nowake <nowake@...>
2004/07/20
[#39886] Re: イテレータとfor文
— Tietew <tietew-ml-ruby-list@...>
2004/07/21
[#39891] Re: イテレータとfor文
— OOTANI TAKASHI <otn@...5.so-net.ne.jp>
2004/07/21
大谷です。
[#39910] Re: イテレータとfor文
— Atoh <atoh@...7.jp>
2004/07/23
あとうです。
[#39911] Re: イテレータとfor文
— OOTANI TAKASHI <otn@...5.so-net.ne.jp>
2004/07/23
大谷です。
[#39889] dRuby: 急に遅くなる — ちば けいすけ <chowder@...>
ちばです。
7 messages
2004/07/21
[#39908] htreeの高速化 — MoonWolf <moonwolf@...>
MoonWolfです。
6 messages
2004/07/23
[ruby-list:39845] Re: URI#merge and relative references
From:
akira yamada / やまだあきら <akira@...>
Date:
2004-07-08 15:30:03 UTC
List:
ruby-list #39845
>>>>> In [ruby-list : No.39844]
>>>>> sheepman <sheepman@tcn.zaq.ne.jp> wrote:
> u = URI.parse("http://www.example.com/") + "./foo/bar/.."
> puts u.to_s #=> http://www.example.com/foo
> puts (u + "./").to_s #=> http://www.example.com/
>
> foo の後ろの "/" が消えてしまうので、その後に "./" を足すと
> ディレクトリである foo が消えてしまいます。
これでどうでしょう:
--- lib/uri/generic.rb 2004-07-08 23:56:52.000000000 +0900
+++ lib/uri/generic.rb 2004-07-08 23:58:39.000000000 +0900
@@ -634,16 +634,16 @@
base_path << '' if base_path.last == '..'
while i = base_path.index('..')
base_path.slice!(i - 1, 2)
- end
+ end
if base_path.empty?
base_path = [''] # keep '/' for root directory
- else
+ else
base_path.pop
- end
+ end
# RFC2396, Section 5.2, 6), c)
- # RFC2396, Section 5.2, 6), d)
- rel_path.push('') if rel_path.last == '.'
+ # RFC2396, Section 5.2, 6), d)
+ rel_path.push('') if rel_path.last == '.' || rel_path.last == '..'
rel_path.delete('.')
# RFC2396, Section 5.2, 6), e)
--- test/uri/test_generic.rb 2004-07-08 23:56:52.000000000 +0900
+++ test/uri/test_generic.rb 2004-07-08 23:44:43.000000000 +0900
@@ -180,6 +180,16 @@
u0 = URI.parse('http://www.example.com/foo/')
u1 = URI.parse('http://www.example.com/foo/bar/baz/../..') + './'
assert_equal(u0, u1)
+
+ # [ruby-list:39844]
+ u = URI.parse('http://www.example.com/')
+ u0 = u + './foo/'
+ u1 = u + './foo/bar/..'
+ assert_equal(u0, u1)
+ u = URI.parse('http://www.example.com/')
+ u0 = u + './'
+ u1 = u + './foo/bar/../..'
+ assert_equal(u0, u1)
end
def test_route