[#11073] segfault printing instruction sequence for iterator — <noreply@...>
Bugs item #10527, was opened at 2007-05-02 14:42
Hi,
On Thu, May 10, 2007 at 04:51:18PM +0900, Nobuyoshi Nakada wrote:
Hi,
Hi,
This seems to make valgrind much happier.
On Thu, May 17, 2007 at 11:14:35PM +0900, Paul Brannan wrote:
Hi,
Now 'a' shows up twice in the local table:
Hi,
[#11082] Understanding code: Kernel#require and blocks. — Hugh Sasse <hgs@...>
I'm trying to debug a Rails application which complains about an
On 5/4/07, Hugh Sasse <hgs@dmu.ac.uk> wrote:
On Fri, 4 May 2007, George wrote:
On Fri, May 04, 2007 at 06:18:19PM +0900, Hugh Sasse wrote:
[#11108] pattern for implementation-private constants? — David Flanagan <david@...>
Hi,
I believe there isn't a way, but I don't think it's really necessary. Just
[#11127] Bugs that can be closed — "Jano Svitok" <jan.svitok@...>
I propose closing these bugs as invalid:
[#11145] Rational comparison to 0 fails when denominator is != 1 — <noreply@...>
Bugs item #10739, was opened at 2007-05-10 22:06
Hi,
[#11169] Allow back reference with nest level in Oniguruma for Ruby again — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <wonado@...>
Remark: I posted this text in comp.lang.ruby first, but Matz told me,
Does it make sense or is it required to write this as a RCR?
[#11176] FileUtils.rm_rf misfeature? — johan556@...
Hi!
[#11210] Pathname ascend and descend inclusive parameter — TRANS <transfire@...>
I would like to suggest that Pathname#ascend and Pathname#descend
[#11234] Planning to release 1.8.6 errata — Urabe Shyouhei <shyouhei@...>
Hi all.
On 25/05/07, Urabe Shyouhei <shyouhei@ruby-lang.org> wrote:
[#11252] Init_stack and ruby_init_stack fail to reinit stack (threads problem?) — <noreply@...>
Bugs item #11134, was opened at 2007-05-25 12:14
Hi,
Nobuyoshi Nakada wrote:
[#11255] ruby_1_8_6 build problem (make install-doc) — johan556@...
Hi!
[#11271] providing better support through rubyforge tracker categories — Ryan Davis <ryand-ruby@...>
I'm going to make more categories for the trackers (bugs and patches)
[#11367] BUG: next in lambda: 1.8.6 differs from 1.8.4 and 1.9.0 — David Flanagan <david@...>
A toplevel next statement in a lambda does not return a value in 1.8.6,
[#11368] $2000 USD Reward for help fixing Segmentation Fault in GC — Brent Roman <brent@...>
Hi Brent,
[ ruby-Bugs-10340 ] Net::HTTP encodes parameters improperly.
Bugs item #10340, was opened at 2007-04-25 00:49
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=10340&group_id=426
Category: Standard Library
Group: 1.8.5
Status: Open
Resolution: None
Priority: 3
Submitted By: Colin Curtin (perplexes)
Assigned to: Nobody (None)
Summary: Net::HTTP encodes parameters improperly.
Initial Comment:
While trying to post a web form with lots of checkboxes, I ran into the interesting problem that Hash's with arrays for values, when doing a Net::HTTP.post_form, does not work properly.
To illustrate:
"
require 'net/http'
require 'uri'
uri = URI.parse('http://ihateosx.com/~colin/post_test.php')
data = {'test[]' => ['one', 'two', 'three']}
response = Net::HTTP.post_form(uri, data)
print response.body
"
Results in:
array(1) {
["test"]=>
array(1) {
[0]=>
string(11) "onetwothree"
}
}
=> nil
When we look around in net/http.rb, the problem becomes obvious:
def set_form_data(params, sep = '&')
self.body = params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep)
self.content_type = 'application/x-www-form-urlencoded'
end
The method does not allow for arrays to be values in the params Hash. Array.to_s only appends strings together.
Without doing much research, I turn it into:
def set_form_data(params, sep = '&')
params_array = params.map do |k,v|
v.inject([]){|c, val| c << "#{urlencode(k.to_s)}=#{urlencode(val.to_s)}"}.join(sep)
end
self.body = params_array.join(sep)
self.content_type = 'application/x-www-form-urlencoded'
end
Which will take something like
{'test[]' => ['one', 'two', 'three']}
and turn it into
test[]=one&test[]=two&test[]=three
Which is correct for array post parameters. And indeed the PHP test page shows it also:
array(1) {
["test"]=>
array(3) {
[0]=>
string(3) "one"
[1]=>
string(3) "two"
[2]=>
string(5) "three"
}
}
=> nil
So, what to do from here? This is my first Ruby bug report. Please be gentle. :)
----------------------------------------------------------------------
Comment By: Minero Aoki (aamine)
Date: 2007-05-06 19:02
Message:
Thank you for your report. I commited my patch which allows you to give form parameters by an array of strings (of course, a string is allowed, too). It goes to 1.8 branch after short verification term.
----------------------------------------------------------------------
Comment By: Scott Archer (scarcher2)
Date: 2007-05-04 22:54
Message:
Index: lib/net/http.rb
===================================================================
--- lib/net/http.rb (revision 12246)
+++ lib/net/http.rb (working copy)
@@ -1454,7 +1454,10 @@
# This method also set Content-Type: header field to
# application/x-www-form-urlencoded.
def set_form_data(params, sep = '&')
- self.body = params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep)
+ params_array = params.map do |k,v|
+ v.inject([]){|c, val| c << "#{urlencode(k.to_s)}=#{urlencode(val.to_s)}"}.join(sep)
+ end
+ self.body = params_array.join(sep)
self.content_type = 'application/x-www-form-urlencoded'
end
----------------------------------------------------------------------
Comment By: Colin Curtin (perplexes)
Date: 2007-05-01 00:27
Message:
I contacted the maintainer of this, Minero Aoki
<aamine@loveruby.net>, but have not received a response yet.
----------------------------------------------------------------------
Comment By: Scott Archer (scarcher2)
Date: 2007-04-29 03:49
Message:
I also had this same problem.
I submitted a patch to the ruby core mailing list.
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/11052
My solution wasn't as concise as yours (I'm new to ruby) but it does the exact same thing.
I'm still trying to figure out how to participate in the community.
I'd like to see this bug fixed, and the fix doesn't break any of the unit tests.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=10340&group_id=426