Project

General

Profile

Bug #7650

net/http always added port number in host header.

Added by Hiroshi SHIBATA about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
ruby -v:
ruby 2.0.0dev (2013-01-02 trunk 38676) [x86_64-darwin12.2.1]
Backport:
2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
[ruby-dev:46829]

Description

#6482 の変更から、URI インスタンスを Net::HTTP のリクエストに渡した時に host ヘッダにホスト名とポート番号がつくようになりましたが、いくつかのサービスはポート番号付きのリクエストは動かないようです。(例: amazon の ecs api)

w3c に従うと、ポート番号を付けても動くべきと思いますが、今現在 amazon のような大きなサービスでも動かない状況なので、添付しているパッチのように 2.0 ではポート番号は付けないようして頂けないでしょうか。

参考URL:
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23
* https://github.com/tdiary/tdiary-core/issues/225

generic_request.patch Magnifier (461 Bytes) Hiroshi SHIBATA, 01/03/2013 05:01 PM

generic_request2.patch Magnifier (529 Bytes) Hiroshi SHIBATA, 01/05/2013 07:44 PM

Associated revisions

Revision 38707
Added by Yui NARUSE about 3 years ago

  • lib/net/http/generic_request.rb: Amazon ECA API and GTE/1.3 disallow requests whose host has port number if its port number equlas to default port number of the scheme. [Bug #7650]

Revision 38707
Added by Yui NARUSE about 3 years ago

  • lib/net/http/generic_request.rb: Amazon ECA API and GTE/1.3 disallow requests whose host has port number if its port number equlas to default port number of the scheme. [Bug #7650]

History

#1 [ruby-dev:46836] Updated by Yusuke Endoh about 3 years ago

  • Status changed from Open to Assigned
  • Priority changed from Normal to 6

#2 [ruby-dev:46837] Updated by Hiroshi SHIBATA about 3 years ago

tDiary の issue にも記載していますが、nahi さんの httpclient でもデフォルトのポート番号は付けないように回避しているようです。

https://github.com/nahi/httpclient/blob/master/lib/httpclient/http.rb#L395

#3 [ruby-dev:46838] Updated by Yusuke Endoh about 3 years ago

  • Priority changed from 6 to 7

#4 [ruby-dev:46839] Updated by Hiroshi SHIBATA about 3 years ago

httpclient にあわせて、全てのポート番号を無視するのではなく uri scheme のデフォルトポートの場合は付けないようにパッチを修正しました。この内容で検討をお願いします。

#5 Updated by Yui NARUSE about 3 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38707.
Hiroshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/net/http/generic_request.rb: Amazon ECA API and GTE/1.3 disallow requests whose host has port number if its port number equlas to default port number of the scheme. [Bug #7650]

Also available in: Atom PDF