File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Wed Feb 18 00:27:57 2015 Eric Hodel <drbrain@segment7.net>
2+
3+ * lib/net/http.rb: Do not attempt SSL session resumption when the
4+ session is expired. [Bug #10533]
5+
16Wed Feb 18 00:20:36 2015 Eric Wong <e@80x24.org>
27
38 * vm_eval.c (rb_yield_splat): add missing GC guard
Original file line number Diff line number Diff line change @@ -914,7 +914,10 @@ def connect
914914 @socket . write ( buf )
915915 HTTPResponse . read_new ( @socket ) . value
916916 end
917- s . session = @ssl_session if @ssl_session
917+ if @ssl_session and
918+ Time . now < @ssl_session . time + @ssl_session . timeout
919+ s . session = @ssl_session if @ssl_session
920+ end
918921 # Server Name Indication (SNI) RFC 3546
919922 s . hostname = @address if s . respond_to? :hostname=
920923 Timeout . timeout ( @open_timeout , Net ::OpenTimeout ) { s . connect }
Original file line number Diff line number Diff line change @@ -73,12 +73,45 @@ def test_session_reuse
7373 http . get ( "/" )
7474 http . finish # three times due to possible bug in OpenSSL 0.9.8
7575
76+ sid = http . instance_variable_get ( :@ssl_session ) . id
77+
7678 http . start
7779 http . get ( "/" )
7880
7981 socket = http . instance_variable_get ( :@socket ) . io
8082
8183 assert socket . session_reused?
84+
85+ assert_equal sid , http . instance_variable_get ( :@ssl_session ) . id
86+
87+ http . finish
88+ rescue SystemCallError
89+ skip $!
90+ end
91+
92+ def test_session_reuse_but_expire
93+ http = Net ::HTTP . new ( "localhost" , config ( "port" ) )
94+ http . use_ssl = true
95+ http . verify_callback = Proc . new do |preverify_ok , store_ctx |
96+ store_ctx . current_cert . to_der == config ( 'ssl_certificate' ) . to_der
97+ end
98+
99+ http . ssl_timeout = -1
100+ http . start
101+ http . get ( "/" )
102+ http . finish
103+
104+ sid = http . instance_variable_get ( :@ssl_session ) . id
105+
106+ http . start
107+ http . get ( "/" )
108+
109+ socket = http . instance_variable_get ( :@socket ) . io
110+ assert_equal false , socket . session_reused?
111+
112+ assert_not_equal sid , http . instance_variable_get ( :@ssl_session ) . id
113+
114+ http . finish
82115 rescue SystemCallError
83116 skip $!
84117 end
Original file line number Diff line number Diff line change 11#define RUBY_VERSION "2.1.5"
22#define RUBY_RELEASE_DATE "2015-02-18"
3- #define RUBY_PATCHLEVEL 296
3+ #define RUBY_PATCHLEVEL 297
44
55#define RUBY_RELEASE_YEAR 2015
66#define RUBY_RELEASE_MONTH 2
You can’t perform that action at this time.
0 commit comments