ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: shishir127@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:69773] [Ruby trunk - Bug #11281] Unexpected behaviour in HTTP header processing
Date: Mon, 29 Jun 2015 16:34:49 +0000	[thread overview]
Message-ID: <redmine.journal-53151.20150629163448.39de3991cd45f05f@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11281.20150618134940@ruby-lang.org

Issue #11281 has been updated by Shishir Joshi.


I think if the user wants to send a blank header, then the user should do that explicitly like so 
~~~
Net::HTTP::Get.new('http://any.url', {'header' => ""})
~~~
 Converting a `nil` value to a blank string is not so obvious behaviour so I am OK with skipping `nil` values.

----------------------------------------
Bug #11281: Unexpected behaviour in HTTP header processing
https://bugs.ruby-lang.org/issues/11281#change-53151

* Author: John Carter
* Status: Feedback
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Running this:

~~~ruby
Net::HTTP::Get.new('http://any.url', {'header' => nil})
~~~

Results in:

~~~
NoMethodError: undefined method `strip' for nil:NilClass
	from /home/vagrant/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/http/header.rb:17:in `block in initialize_http_header'
	from /home/vagrant/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/http/header.rb:15:in `each'
	from /home/vagrant/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/http/header.rb:15:in `initialize_http_header'
	from /home/vagrant/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/http/generic_request.rb:43:in `initialize'
	from /home/vagrant/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/http/request.rb:14:in `initialize'
	from (irb):13:in `new'
	from (irb):13
~~~

Suggest implementation changes to assume a `nil` header value is the same as an empty string.

Thanks,

John



-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2015-06-29 16:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-11281.20150618134940@ruby-lang.org>
2015-06-18 13:49 ` [ruby-core:69652] [Ruby trunk - Bug #11281] [Open] Unexpected behaviour in HTTP header processing jcarter
2015-06-28 11:45 ` [ruby-core:69761] [Ruby trunk - Bug #11281] [Feedback] " nobu
2015-06-29 16:34 ` shishir127 [this message]
2015-06-30  3:16 ` [ruby-core:69787] [Ruby trunk - Bug #11281] [Rejected] " nobu
2015-07-01 12:27 ` [ruby-core:69828] [Ruby trunk - Bug #11281] " shishir127

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-53151.20150629163448.39de3991cd45f05f@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).