Project

General

Profile

Actions

Bug #655

closed

Query part lost when using Net::HTTP.post_form function

Added by klesh (Klesh Wong) almost 13 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
should be the latest at that time
Backport:
[ruby-core:19365]

Description

=begin
when posting data by following code:

require 'net/http'
require 'uri'

response = Net::HTTP.post_form URI.parse('http://localhost/api.asp?Action=Check'), {'name'=>'value'}
puts response.body

query part ("Action=Check" in this case) are not attached.
server side receive a request /api.asp without query.

problem could be solved by simple change post_form code:
req = Post.new(url.path)
to
req = Post.new(url.request_uri)

i'm not sure it is a bug or i mis-understand, if i do, is there anyway to post form with query, for i need to deal with some Third Part API.
=end

Actions #1

Updated by shyouhei (Shyouhei Urabe) over 12 years ago

  • Assignee set to aamine (Minero Aoki)

=begin

=end

Actions #2

Updated by nahi (Hiroshi Nakamura) about 11 years ago

  • Category set to lib
  • Assignee changed from aamine (Minero Aoki) to nahi (Hiroshi Nakamura)
  • ruby -v set to should be the latest at that time

=begin

=end

Actions #3

Updated by shyouhei (Shyouhei Urabe) about 11 years ago

  • Status changed from Open to Assigned

=begin

=end

Actions #4

Updated by meta (mathew murphy) almost 11 years ago

=begin
Note that you'll need to decide whether you want to comply with the HTTP spec, or with RFC 3986. See http://lpar.ath0.com/2008/10/26/rfc-3986-considered-harmful/
=end

Actions #5

Updated by nahi (Hiroshi Nakamura) over 10 years ago

  • Project changed from Ruby 1.8 to Ruby master
  • Category changed from lib to lib

Updated by nahi (Hiroshi Nakamura) over 10 years ago

  • Status changed from Assigned to Closed

mathew: Interesting read. Thanks. I decided to not decide and let users choose, by allowing to include query part as a request URI.

Actions

Also available in: Atom PDF