Issue #14411 has been updated by artur86 (Artur Beljajev).


sos4nt (Stefan Schler) wrote:
> artur86 (Artur Beljajev) wrote:
> > Base class might always return false, whereas HTTPS class should return true then.
> 
> Note that you can change the scheme:
> 
> ```ruby
> uri = URI('http://example.com/')
> uri.scheme = 'https'
> 

My fault. I assumed it is immutable, for some reason. Then it will check current scheme dynamically.
> uri         #=> #<URI::HTTP https://example.com/>
> uri.class   #=> URI::HTTP
> uri.scheme  #=> "https"
> ```



----------------------------------------
Feature #14411: URI#secure?
https://bugs.ruby-lang.org/issues/14411#change-70018

* Author: artur86 (Artur Beljajev)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I wonder if some predicate method (say #secure?) could be added to URI::Generic class. Currently the only way to query if uri is secure is:

~~~ ruby
uri.instance_of?(URI::HTTPS)
~~~

Inspired by this question: https://stackoverflow.com/questions/2212735/ruby-checking-if-uri-is-https



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>