gem 0.0.1.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.md +75 -0
- data/bin/gem +7 -0
- data/lib/gem.rb +249 -0
- data/lib/gem/configuration.rb +43 -0
- data/lib/gem/dependency.rb +2 -0
- data/lib/gem/platform.rb +76 -0
- data/lib/gem/progressbar.rb +269 -0
- data/lib/gem/requirement.rb +9 -0
- data/lib/gem/source_index.rb +8 -0
- data/lib/gem/specification.rb +202 -0
- data/lib/gem/tar.rb +7 -0
- data/lib/gem/tar/entry.rb +145 -0
- data/lib/gem/tar/header.rb +266 -0
- data/lib/gem/tar/reader.rb +101 -0
- data/lib/gem/tar/writer.rb +240 -0
- data/lib/gem/thread_poolable.rb +59 -0
- data/lib/gem/version.rb +73 -0
- data/lib/gem/version/requirement.rb +1 -0
- data/lib/net/http/faster.rb +27 -0
- data/lib/net/http/persistent.rb +978 -0
- data/lib/net/http/persistent/ssl_reuse.rb +129 -0
- data/lib/rubygems.rb +1 -0
- data/lib/ubygems.rb +1 -0
- metadata +70 -0
@@ -0,0 +1,129 @@
|
|
1
|
+
##
|
2
|
+
# This Net::HTTP subclass adds SSL session reuse and Server Name Indication
|
3
|
+
# (SNI) RFC 3546.
|
4
|
+
#
|
5
|
+
# DO NOT DEPEND UPON THIS CLASS
|
6
|
+
#
|
7
|
+
# This class is an implementation detail and is subject to change or removal
|
8
|
+
# at any time.
|
9
|
+
|
10
|
+
class Net::HTTP::Persistent::SSLReuse < Net::HTTP
|
11
|
+
|
12
|
+
@is_proxy_class = false
|
13
|
+
@proxy_addr = nil
|
14
|
+
@proxy_port = nil
|
15
|
+
@proxy_user = nil
|
16
|
+
@proxy_pass = nil
|
17
|
+
|
18
|
+
def initialize address, port = nil # :nodoc:
|
19
|
+
super
|
20
|
+
|
21
|
+
@ssl_session = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# From ruby trunk r33086 including http://redmine.ruby-lang.org/issues/5341
|
26
|
+
|
27
|
+
def connect # :nodoc:
|
28
|
+
D "opening connection to #{conn_address()}..."
|
29
|
+
s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }
|
30
|
+
D "opened"
|
31
|
+
if use_ssl?
|
32
|
+
ssl_parameters = Hash.new
|
33
|
+
iv_list = instance_variables
|
34
|
+
SSL_ATTRIBUTES.each do |name|
|
35
|
+
ivname = "@#{name}".intern
|
36
|
+
if iv_list.include?(ivname) and
|
37
|
+
value = instance_variable_get(ivname)
|
38
|
+
ssl_parameters[name] = value
|
39
|
+
end
|
40
|
+
end
|
41
|
+
unless @ssl_context then
|
42
|
+
@ssl_context = OpenSSL::SSL::SSLContext.new
|
43
|
+
@ssl_context.set_params(ssl_parameters)
|
44
|
+
end
|
45
|
+
s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)
|
46
|
+
s.sync_close = true
|
47
|
+
end
|
48
|
+
@socket = Net::BufferedIO.new(s)
|
49
|
+
@socket.read_timeout = @read_timeout
|
50
|
+
@socket.continue_timeout = @continue_timeout if
|
51
|
+
@socket.respond_to? :continue_timeout
|
52
|
+
@socket.debug_output = @debug_output
|
53
|
+
if use_ssl?
|
54
|
+
begin
|
55
|
+
if proxy?
|
56
|
+
@socket.writeline sprintf('CONNECT %s:%s HTTP/%s',
|
57
|
+
@address, @port, HTTPVersion)
|
58
|
+
@socket.writeline "Host: #{@address}:#{@port}"
|
59
|
+
if proxy_user
|
60
|
+
credential = ["#{proxy_user}:#{proxy_pass}"].pack('m')
|
61
|
+
credential.delete!("\r\n")
|
62
|
+
@socket.writeline "Proxy-Authorization: Basic #{credential}"
|
63
|
+
end
|
64
|
+
@socket.writeline ''
|
65
|
+
Net::HTTPResponse.read_new(@socket).value
|
66
|
+
end
|
67
|
+
s.session = @ssl_session if @ssl_session
|
68
|
+
# Server Name Indication (SNI) RFC 3546
|
69
|
+
s.hostname = @address if s.respond_to? :hostname=
|
70
|
+
timeout(@open_timeout) { s.connect }
|
71
|
+
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
|
72
|
+
s.post_connection_check(@address)
|
73
|
+
end
|
74
|
+
@ssl_session = s.session
|
75
|
+
rescue => exception
|
76
|
+
D "Conn close because of connect error #{exception}"
|
77
|
+
@socket.close if @socket and not @socket.closed?
|
78
|
+
raise exception
|
79
|
+
end
|
80
|
+
end
|
81
|
+
on_connect
|
82
|
+
end if RUBY_VERSION > '1.9'
|
83
|
+
|
84
|
+
##
|
85
|
+
# From ruby_1_8_7 branch r29865 including a modified
|
86
|
+
# http://redmine.ruby-lang.org/issues/5341
|
87
|
+
|
88
|
+
def connect # :nodoc:
|
89
|
+
D "opening connection to #{conn_address()}..."
|
90
|
+
s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }
|
91
|
+
D "opened"
|
92
|
+
if use_ssl?
|
93
|
+
unless @ssl_context.verify_mode
|
94
|
+
warn "warning: peer certificate won't be verified in this SSL session"
|
95
|
+
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
96
|
+
end
|
97
|
+
s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)
|
98
|
+
s.sync_close = true
|
99
|
+
end
|
100
|
+
@socket = Net::BufferedIO.new(s)
|
101
|
+
@socket.read_timeout = @read_timeout
|
102
|
+
@socket.debug_output = @debug_output
|
103
|
+
if use_ssl?
|
104
|
+
if proxy?
|
105
|
+
@socket.writeline sprintf('CONNECT %s:%s HTTP/%s',
|
106
|
+
@address, @port, HTTPVersion)
|
107
|
+
@socket.writeline "Host: #{@address}:#{@port}"
|
108
|
+
if proxy_user
|
109
|
+
credential = ["#{proxy_user}:#{proxy_pass}"].pack('m')
|
110
|
+
credential.delete!("\r\n")
|
111
|
+
@socket.writeline "Proxy-Authorization: Basic #{credential}"
|
112
|
+
end
|
113
|
+
@socket.writeline ''
|
114
|
+
Net::HTTPResponse.read_new(@socket).value
|
115
|
+
end
|
116
|
+
s.session = @ssl_session if @ssl_session
|
117
|
+
s.connect
|
118
|
+
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
|
119
|
+
s.post_connection_check(@address)
|
120
|
+
end
|
121
|
+
@ssl_session = s.session
|
122
|
+
end
|
123
|
+
on_connect
|
124
|
+
end if RUBY_VERSION < '1.9'
|
125
|
+
|
126
|
+
private :connect
|
127
|
+
|
128
|
+
end
|
129
|
+
|
data/lib/rubygems.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'gem'
|
data/lib/ubygems.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'gem'
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.alpha
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Samuel Cochran
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-30 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Just enough not-Rubygems to index a collection of gems for download...
|
15
|
+
and maybe more.
|
16
|
+
email: sj26@sj26.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- LICENSE
|
22
|
+
- README.md
|
23
|
+
- bin/gem
|
24
|
+
- lib/gem.rb
|
25
|
+
- lib/gem/configuration.rb
|
26
|
+
- lib/gem/dependency.rb
|
27
|
+
- lib/gem/platform.rb
|
28
|
+
- lib/gem/progressbar.rb
|
29
|
+
- lib/gem/requirement.rb
|
30
|
+
- lib/gem/source_index.rb
|
31
|
+
- lib/gem/specification.rb
|
32
|
+
- lib/gem/tar.rb
|
33
|
+
- lib/gem/tar/entry.rb
|
34
|
+
- lib/gem/tar/header.rb
|
35
|
+
- lib/gem/tar/reader.rb
|
36
|
+
- lib/gem/tar/writer.rb
|
37
|
+
- lib/gem/thread_poolable.rb
|
38
|
+
- lib/gem/version.rb
|
39
|
+
- lib/gem/version/requirement.rb
|
40
|
+
- lib/net/http/faster.rb
|
41
|
+
- lib/net/http/persistent.rb
|
42
|
+
- lib/net/http/persistent/ssl_reuse.rb
|
43
|
+
- lib/rubygems.rb
|
44
|
+
- lib/ubygems.rb
|
45
|
+
homepage: https://github.com/sj26/gem
|
46
|
+
licenses: []
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>'
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.3.1
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.8.11
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Not-rubygems
|
69
|
+
test_files: []
|
70
|
+
has_rdoc:
|