Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > 6d36cb72372cfb7c8fee63f4d6dc0530 > files > 373

ruby-docs-1.8.5-31.el5_9.x86_64.rpm

<?xml version="1.0" encoding="EUC-JP" ?>
<!DOCTYPE html 
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>net/https.rb</title>
<meta http-equiv="Content-type" content="text/html; charset=EUC-JP" />
<link href="default.css" type="text/css" rel="stylesheet" />
<link href="refm201.html" rel="next" />
<link href="refm199.html" rel="prev" />
<link href="index.html" rel="start" />

</head>
<body>
<div class="navigator"><span class="navigator">[<a href="index.html">MAIN</a>][<a href="refm482.html">INDEX</a>][<a href="refm483.html">KEYWORD</a>][<a href="refm594.html">METHOD</a>(<a href="refm633.html">NC</a>)]&nbsp;&nbsp;&nbsp;[<a href="index.html">TOP</a>][<a href="refm109.html">UP</a>][<a href="refm199.html">&lt;-PREV</a>][<a href="refm201.html">NEXT-&gt;</a>]</span></div>
<hr />

<h1><a name="L003383" id="L003383">$RCSfile: https.rb,v $ -- SSL/TLS enhancement for Net::HTTP.</a></h1>
<h1><a name="L003384" id="L003384">Info</a></h1>
<pre>'OpenSSL for Ruby 2' project
Copyright (C) 2001 GOTOU Yuuzou &lt;gotoyuzo@notwork.org&gt;
All rights reserved.</pre>
<h1><a name="L003385" id="L003385">Licence</a></h1>
<pre>This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)</pre>
<h1><a name="L003386" id="L003386">Requirements</a></h1>
<pre>This program requires Net 1.2.0 or higher version.
You can get it from RAA or Ruby's CVS repository.</pre>
<h1><a name="L003387" id="L003387">Version</a></h1>
<pre>$Id: https.rb,v 1.2 2003/07/28 19:06:31 gotoyuzo Exp $

2001/11/06: Contiributed to Ruby/OpenSSL project.</pre>
<h2><a name="L003388" id="L003388">class Net::HTTP</a></h2>
<h2><a name="L003389" id="L003389">Example</a></h2>
<p>Simple HTTP client is here:</p>
<pre>require 'net/http'
host, port, path = &quot;localhost&quot;, 80, &quot;/&quot;
if %r!http://(.*?)(?::(\d+))?(/.*)! =~ ARGV[0]
  host   = $1
  port   = $2.to_i if $2
  path   = $3
end
h = Net::HTTP.new(host, port)
h.get2(path){ |resp| print resp.body }</pre>
<p>It can be replaced by follow one:</p>
<pre>require 'net/https'
host, port, path = &quot;localhost&quot;, 80, &quot;/&quot;
if %r!(https?)://(.*?)(?::(\d+))?(/.*)! =~ ARGV[0]
  scheme = $1
  host   = $2
  port   = $3 ? $3.to_i : ((scheme == &quot;http&quot;) ? 80 : 443)
  path   = $4
end
h = Net::HTTP.new(host, port)
h.use_ssl = true if scheme == &quot;https&quot; # enable SSL/TLS
h.get2(path){ |resp| print resp.body }</pre>
<h3><a name="L003390" id="L003390">Instance Methods</a></h3>
<dl>
<dt><a name="L003391" id="L003391">use_ssl</a></dt>
<dd>
<p>returns ture if use SSL/TLS with HTTP.</p>
</dd>
<dt><a name="L003392" id="L003392">use_ssl=<var>true_or_false</var></a></dt>
<dd>
<p>sets use_ssl.</p>
</dd>
<dt><a name="L003393" id="L003393">peer_cert</a></dt>
<dd>
<p>return the X.509 certificates the server presented.</p>
</dd>
<dt><a name="L003394" id="L003394">key=<var>key</var></a></dt>
<dd>
<p>Sets an OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
(This method is appeared in Michal Rokos's OpenSSL extention.)</p>
</dd>
<dt><a name="L003395" id="L003395">key_file=<var>path</var></a></dt>
<dd>
<p>Sets a private key file to use in PEM format.</p>
</dd>
<dt><a name="L003396" id="L003396">cert=<var>cert</var></a></dt>
<dd>
<p>Sets an OpenSSL::X509::Certificate object as client certificate.
(This method is appeared in Michal Rokos's OpenSSL extention.)</p>
</dd>
<dt><a name="L003397" id="L003397">cert_file=<var>path</var></a></dt>
<dd>
<p>Sets pathname of a X.509 certification file in PEM format.</p>
</dd>
<dt><a name="L003398" id="L003398">ca_file=<var>path</var></a></dt>
<dd>
<p>Sets path of a CA certification file in PEM format.
The file can contrain several CA certificats.</p>
</dd>
<dt><a name="L003399" id="L003399">ca_path=<var>path</var></a></dt>
<dd>
<p>Sets path of a CA certification directory containing certifications
in PEM format.</p>
</dd>
<dt><a name="L003400" id="L003400">verify_mode=<var>mode</var></a></dt>
<dd>
<p>Sets the flags for server the certification verification at
begining of SSL/TLS session.
OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER is acceptable.</p>
</dd>
<dt><a name="L003401" id="L003401">verify_callback=<var>proc</var></a></dt>
<dd>
<p>Sets the verify callback for the server certification verification.</p>
</dd>
<dt><a name="L003402" id="L003402">verify_depth=<var>num</var></a></dt>
<dd>
<p>Sets the maximum depth for the certificate chain verification.</p>
</dd>
<dt><a name="L003403" id="L003403">cert_store=<var>store</var></a></dt>
<dd>
<p>Sets the X509::Store to verify peer certificate.</p>
</dd>
</dl>

<hr />
<div class="navigator"><span class="navigator">[<a href="index.html">MAIN</a>][<a href="refm482.html">INDEX</a>][<a href="refm483.html">KEYWORD</a>][<a href="refm594.html">METHOD</a>(<a href="refm633.html">NC</a>)]&nbsp;&nbsp;&nbsp;[<a href="index.html">TOP</a>][<a href="refm109.html">UP</a>][<a href="refm199.html">&lt;-PREV</a>][<a href="refm201.html">NEXT-&gt;</a>]</span></div>

</body>
</html>