[#3861] super — ts <decoux@...>
[#3862] Marshal.dump'ing OpenStruct objects — Mauricio Fern疣dez <batsman.geo@...>
Hi,
[#3881] mkdir, mkdir_p in FileUtils and mode — Florian Frank <flori@...>
Hello,
[#3907] Obtaining mode information on an IO object — Jos Backus <jos@...>
The attached patch implements IO#mode. This method returns the mode the IO
Hi,
On Tue, Dec 07, 2004 at 09:25:13AM +0900, nobu.nokada@softhome.net wrote:
Jos Backus wrote:
Hi,
On Thu, Dec 09, 2004 at 10:47:48AM +0900, nobu.nokada@softhome.net wrote:
On Thu, Dec 09, 2004 at 02:40:33PM +0900, James Britt wrote:
[#3914] Pathname needs a makeover — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#3922] Incorrect escaping in strings produced by String::inspect — noreply@...
Bugs item #1173, was opened at 2004-12-08 17:35
[#3966] unknown node type 0 — Andrew Walrond <andrew@...>
I still get this happening a lot with my Rubyx linux ruby script.
This is a long standing bug in Ruby, and has been reported hundreds of times
Hi,
[#3975] Patches to test/unit — Ryan Davis <ryand-ruby@...>
I believe these are the minimal patches needed to make it possible to
[#3982] Win32: rb_sys_fail() - errno == 0 — Florian Gro<florgro@...>
Moin!
[#4000] 1.8.2 preview4 — Yukihiro Matsumoto <matz@...>
Hello,
[#4009] cgi.rb -- more GET/POST stuff — mde@...26.com
First of all, I think it would be great, as Eustaquio suggests, to
GETs and POSTs are defined to be fairly different actions. I'd read
-----BEGIN PGP SIGNED MESSAGE-----
Francis Hwang wrote:
-----BEGIN PGP SIGNED MESSAGE-----
First of all, the entire discussion of when GET is appropriate
mde@state26.com wrote:
[#4027] Allowing custom number literal suffixes? — Florian Gro<florgro@...>
Moin!
Hi,
Mathieu Bouchard wrote:
Mathieu Bouchard wrote:
I'm not sure I would advocate making Ruby's grammar even more
>
Brent Roman wrote:
> Brent Roman wrote:
Brent Roman wrote:
> Florian Gross wrote:
Mathieu Bouchard wrote:
Mathieu Bouchard wrote:
[#4033] Garbage collection trouble — Christian Neukirchen <chneukirchen@...>
Hello,
>>>>> "C" == Christian Neukirchen <chneukirchen@gmail.com> writes:
ts <decoux@moulon.inra.fr> writes:
>>>>> "C" == Christian Neukirchen <chneukirchen@gmail.com> writes:
[#4040] Extensions, Internal — Jgen Mangler <juergen.mangler@...>
Hi,
cgi.rb GET and POST values patch
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello there. :-)
First of all, let me say that I'm just learning Ruby and think that is
really a wonderful language and have a very fine community. People are cool
here. :-)
I'm just reading and learning how to program in Ruby for some few days, and
as I use PHP as my main web development language, I'm testing mod_ruby and
eruby.
One thing I missed is a way to put the GET and POST values on differente
places there. I think it's more safe to keep it separated, there is a good
discussion about this here:
http://simon.incutio.com/archive/2003/10/25/difference
I use to always refer to my posted form values in different way I get the
parameters that came from the URL. Don't know what you guys think about it,
but I think is a good way to *try* to avoid some "dirty tricks" that people
can do. Let me hear what you think about that. :-)
But, I just took my chances here and developed (!) a patch (!!) for the
cgi.rb module, that allow to reference to the POST and GET parameters
values on different places. There was
CGI.params
and it is still there, no need to changes, but there is now
CGI.get_params
and
CGI.post_params
and I made this based on the env_method value.
Making a little test here with a eruby file, I attached the file
eruby_form.rhtml.
Tell me what you think about.
I'm attaching also the patch file, I really don't know if I did that the
right way, forgive me some mistakes but I'm still (and will keep) learning
about Ruby.
Thanks for your attention and keep the good work! :-)
- ----------------------------
Eust痃uio "TaQ" Rangel
eustaquiorangel@yahoo.com
http://beam.to/taq
Usu疵io GNU/Linux no. 224050
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBydlBb6UiZnhJiLsRAmZ2AKCl5f8K7+skL2hmxR77AEzr8FGjuACdGMtj
NyUvEofUqvktFCxWrac5JMU=
=ODr9
-----END PGP SIGNATURE-----
--------------050808070301030607000002
Content-Type: text/plain;
name="eruby_form.rhtml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="eruby_form.rhtml"
<%
require 'cgi' # Require the CGI library
cgi = CGI.new() # New CGI object
username = cgi.post_params['username'] # post username
get_test = cgi.get_params['get_test_param'] # get test param
%>
<html><head><title>eRuby Test</title></head>
<body>
<h1>Testing eRuby</h1>
<% if username.empty? # Print out the form asking for the username %>
<form method="post">
Please enter your username: <input type="text" name="username"><br>
<input type="submit" value="Go">
</form>
<% if !get_test.empty? %>
You told me that the get test parameter is <%= get_test %>
<% end %>
<% else %>
Welcome <%= username %>!
<% end %>
</body>
</html>
--------------050808070301030607000002
Content-Type: text/plain;
name="cgi.rb.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="cgi.rb.patch"
--- cgi.rb.old 2004-12-22 13:30:36.000000000 -0200
+++ cgi.rb 2004-12-22 14:54:13.000000000 -0200
@@ -891,7 +891,7 @@
# # "name2" => ["value1", "value2", ...], ... }
#
def CGI::parse(query)
- params = Hash.new([].freeze)
+ params = Hash.new([].freeze)
query.split(/[&;]/n).each do |pairs|
key, value = pairs.split('=',2).collect{|v| CGI::unescape(v) }
@@ -956,6 +956,8 @@
# Get the parameters as a hash of name=>values pairs, where
# values is an Array.
attr("params")
+ attr("get_params")
+ attr("post_params")
# Set all the parameters.
def params=(hash)
@@ -963,6 +965,16 @@
@params.update(hash)
end
+ def get_params=(hash)
+ @get_params.clear
+ @get_params.update(hash)
+ end
+
+ def post_params=(hash)
+ @post_params.clear
+ @post_params.update(hash)
+ end
+
def read_multipart(boundary, content_length)
params = Hash.new([])
boundary = "--" + boundary
@@ -1117,6 +1129,9 @@
)
end
+ @get_params = env_table['REQUEST_METHOD'] == "GET" ? @params : Hash.new([])
+ @post_params = env_table['REQUEST_METHOD'] == "POST" ? @params : Hash.new([])
+
@cookies = CGI::Cookie::parse((env_table['HTTP_COOKIE'] or env_table['COOKIE']))
end
private :initialize_query
@@ -2265,11 +2280,15 @@
initialize_query() # set @params, @cookies
else
if defined?(CGI_PARAMS)
- @params = CGI_PARAMS.nil? ? nil : CGI_PARAMS.dup
- @cookies = CGI_COOKIES.nil? ? nil : CGI_COOKIES.dup
+ @params = CGI_PARAMS.nil? ? nil : CGI_PARAMS.dup
+ @cookies = CGI_COOKIES.nil? ? nil : CGI_COOKIES.dup
+ @get_params = CGI_PARAMS.nil? ? nil : (env_table['REQUEST_METHOD'] == "GET" ? CGI_PARAMS.dup : nil)
+ @post_params = CGI_PARAMS.nil? ? nil : (env_table['REQUEST_METHOD'] == "POST" ? CGI_PARAMS.dup : nil)
else
initialize_query() # set @params, @cookies
- params = @params.nil? ? nil : @params.dup
+ params = @params.nil? ? nil : @params.dup
+ get_params = env_table['REQUEST_METHOD'] == "GET" ? params.dup : nil
+ post_params = env_table['REQUEST_METHOD'] == "POST" ? params.dup : nil
cookies = @cookies.nil? ? nil : @cookies.dup
(class << self; self; end).class_eval do
const_set(:CGI_PARAMS, params)
--------------050808070301030607000002--