PHP 8.2.31
Preview: https.rb Size: 1.61 KB
/proc/thread-self/root/opt/alt/ruby19/lib64/ruby/1.9.1/webrick/https.rb

#
# https.rb -- SSL/TLS enhancement for HTTPServer
#
# Author: IPR -- Internet Programming with Ruby -- writers
# Copyright (c) 2001 GOTOU Yuuzou
# Copyright (c) 2002 Internet Programming with Ruby writers. All rights
# reserved.
#
# $IPR: https.rb,v 1.15 2003/07/22 19:20:42 gotoyuzo Exp $

require 'webrick/ssl'

module WEBrick
  module Config
    HTTP.update(SSL)
  end

  class HTTPRequest
    attr_reader :cipher, :server_cert, :client_cert

    alias orig_parse parse

    def parse(socket=nil)
      if socket.respond_to?(:cert)
        @server_cert = socket.cert || @config[:SSLCertificate]
        @client_cert = socket.peer_cert
        @client_cert_chain = socket.peer_cert_chain
        @cipher      = socket.cipher
      end
      orig_parse(socket)
    end

    alias orig_parse_uri parse_uri

    def parse_uri(str, scheme="https")
      if server_cert
        return orig_parse_uri(str, scheme)
      end
      return orig_parse_uri(str)
    end
    private :parse_uri

    alias orig_meta_vars meta_vars

    def meta_vars
      meta = orig_meta_vars
      if server_cert
        meta["HTTPS"] = "on"
        meta["SSL_SERVER_CERT"] = @server_cert.to_pem
        meta["SSL_CLIENT_CERT"] = @client_cert ? @client_cert.to_pem : ""
        if @client_cert_chain
          @client_cert_chain.each_with_index{|cert, i|
            meta["SSL_CLIENT_CERT_CHAIN_#{i}"] = cert.to_pem
          }
        end
        meta["SSL_CIPHER"] = @cipher[0]
        meta["SSL_PROTOCOL"] = @cipher[1]
        meta["SSL_CIPHER_USEKEYSIZE"] = @cipher[2].to_s
        meta["SSL_CIPHER_ALGKEYSIZE"] = @cipher[3].to_s
      end
      meta
    end
  end
end

Directory Contents

Dirs: 2 × Files: 21

Name Size Perms Modified Actions
httpauth DIR
- drwxr-xr-x 2024-03-03 22:48:05
Edit Download
- drwxr-xr-x 2024-03-03 22:48:05
Edit Download
4.16 KB lrw-r--r-- 2011-06-23 07:22:37
Edit Download
6.90 KB lrw-r--r-- 2010-11-08 20:59:01
Edit Download
912 B lrw-r--r-- 2011-05-17 20:29:58
Edit Download
4.38 KB lrw-r--r-- 2010-09-11 06:21:51
Edit Download
3.03 KB lrw-r--r-- 2011-06-20 06:48:40
Edit Download
707 B lrw-r--r-- 2014-02-14 04:24:27
Edit Download
3.33 KB lrw-r--r-- 2011-05-10 23:37:43
Edit Download
8.85 KB lrw-r--r-- 2011-05-10 00:13:58
Edit Download
12.67 KB lrw-r--r-- 2011-07-22 12:49:34
Edit Download
9.50 KB lrw-r--r-- 2011-06-21 12:58:37
Edit Download
1.61 KB lrw-r--r-- 2011-05-29 14:14:38
Edit Download
7.21 KB lrw-r--r-- 2011-05-10 00:13:58
Edit Download
669 B lrw-r--r-- 2009-10-02 10:45:39
Edit Download
4.95 KB lrw-r--r-- 2011-06-16 21:12:00
Edit Download
10.28 KB lrw-r--r-- 2014-02-14 04:24:27
Edit Download
1.12 KB lrw-r--r-- 2011-05-09 19:22:41
Edit Download
3.60 KB lrw-r--r-- 2011-06-16 21:12:00
Edit Download
5.76 KB lrw-r--r-- 2011-05-10 00:13:58
Edit Download
4.23 KB lrw-r--r-- 2010-07-30 23:26:53
Edit Download
6.23 KB lrw-r--r-- 2012-05-19 05:40:29
Edit Download
353 B lrw-r--r-- 2011-05-09 19:22:41
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).