PHP 8.2.31
Preview: https.rb Size: 1.64 KB
//proc/thread-self/root/opt/alt/ruby18/lib64/ruby/1.8/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)
      @cipher = @server_cert = @client_cert = 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

    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:14
Edit Download
- drwxr-xr-x 2024-03-03 22:48:14
Edit Download
2.25 KB lrw-r--r-- 2011-06-23 09:44:05
Edit Download
6.92 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
436 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
3.13 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
3.03 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
584 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
1.31 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
7.46 KB lrw-r--r-- 2008-06-06 08:05:24
Edit Download
9.99 KB lrw-r--r-- 2010-11-22 07:22:01
Edit Download
7.96 KB lrw-r--r-- 2010-08-16 07:31:35
Edit Download
1.64 KB lrw-r--r-- 2010-12-20 16:55:16
Edit Download
5.63 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
669 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
3.51 KB lrw-r--r-- 2010-06-10 05:23:49
Edit Download
9.96 KB lrw-r--r-- 2010-01-10 10:30:06
Edit Download
1.12 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
2.03 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
5.28 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
4.22 KB lrw-r--r-- 2010-11-22 07:21:52
Edit Download
2.54 KB lrw-r--r-- 2012-06-06 05:20:08
Edit Download
351 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download

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