@@ -180,7 +180,7 @@ def test_BASIC_auth_force
180
180
c . www_auth . basic_auth . instance_eval { @scheme = "BASIC" }
181
181
#
182
182
c . force_basic_auth = true
183
- c . debug_dev = str = ''
183
+ c . debug_dev = str = '' . dup
184
184
c . set_auth ( "http://localhost:#{ serverport } /" , 'admin' , 'admin' )
185
185
assert_equal ( 'basic_auth OK' , c . get_content ( "http://localhost:#{ serverport } /basic_auth" ) )
186
186
assert_equal ( 'Authorization: Basic YWRtaW46YWRtaW4=' . upcase , str . split ( /\r ?\n / ) [ 5 ] . upcase )
@@ -253,7 +253,7 @@ def test_basic_auth_reuses_credentials
253
253
c . set_auth ( "http://localhost:#{ serverport } /" , 'admin' , 'admin' )
254
254
assert_equal ( 'basic_auth OK' , c . get_content ( "http://localhost:#{ serverport } /basic_auth/" ) )
255
255
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
256
- c . debug_dev = str = ''
256
+ c . debug_dev = str = '' . dup
257
257
c . get_content ( "http://localhost:#{ serverport } /basic_auth/sub/dir/" )
258
258
assert_match ( /Authorization: Basic YWRtaW46YWRtaW4=/ , str )
259
259
end
@@ -269,7 +269,7 @@ def test_digest_auth_reuses_credentials
269
269
c . set_auth ( "http://localhost:#{ serverport } /" , 'admin' , 'admin' )
270
270
assert_equal ( 'digest_auth OK' , c . get_content ( "http://localhost:#{ serverport } /digest_auth/" ) )
271
271
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
272
- c . debug_dev = str = ''
272
+ c . debug_dev = str = '' . dup
273
273
c . get_content ( "http://localhost:#{ serverport } /digest_auth/sub/dir/" )
274
274
assert_match ( /Authorization: Digest/ , str )
275
275
end
@@ -315,7 +315,7 @@ def test_perfer_digest
315
315
c . set_auth ( 'http://example.com/' , 'admin' , 'admin' )
316
316
c . test_loopback_http_response << "HTTP/1.0 401 Unauthorized\n WWW-Authenticate: Basic realm=\" foo\" \n WWW-Authenticate: Digest realm=\" foo\" , nonce=\" nonce\" , stale=false\n Content-Length: 2\n \n NG"
317
317
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
318
- c . debug_dev = str = ''
318
+ c . debug_dev = str = '' . dup
319
319
c . get_content ( 'http://example.com/' )
320
320
assert_match ( /^Authorization: Digest/ , str )
321
321
end
@@ -331,7 +331,7 @@ def test_proxy_auth
331
331
c . set_proxy_auth ( 'admin' , 'admin' )
332
332
c . test_loopback_http_response << "HTTP/1.0 407 Unauthorized\n Proxy-Authenticate: Basic realm=\" foo\" \n Content-Length: 2\n \n NG"
333
333
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
334
- c . debug_dev = str = ''
334
+ c . debug_dev = str = '' . dup
335
335
c . get_content ( 'http://example.com/' )
336
336
assert_match ( /Proxy-Authorization: Basic YWRtaW46YWRtaW4=/ , str )
337
337
end
@@ -341,7 +341,7 @@ def test_proxy_auth_force
341
341
c . set_proxy_auth ( 'admin' , 'admin' )
342
342
c . force_basic_auth = true
343
343
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
344
- c . debug_dev = str = ''
344
+ c . debug_dev = str = '' . dup
345
345
c . get_content ( 'http://example.com/' )
346
346
assert_match ( /Proxy-Authorization: Basic YWRtaW46YWRtaW4=/ , str )
347
347
end
@@ -353,7 +353,7 @@ def test_proxy_auth_reuses_credentials
353
353
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
354
354
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
355
355
c . get_content ( 'http://www1.example.com/' )
356
- c . debug_dev = str = ''
356
+ c . debug_dev = str = '' . dup
357
357
c . get_content ( 'http://www2.example.com/' )
358
358
assert_match ( /Proxy-Authorization: Basic YWRtaW46YWRtaW4=/ , str )
359
359
end
@@ -367,7 +367,7 @@ def test_digest_proxy_auth_loop
367
367
ha1 = md5 . hexdigest ( "admin:foo:admin" )
368
368
ha2 = md5 . hexdigest ( "GET:/" )
369
369
response = md5 . hexdigest ( "#{ ha1 } :nonce:#{ ha2 } " )
370
- c . debug_dev = str = ''
370
+ c . debug_dev = str = '' . dup
371
371
c . get_content ( 'http://example.com/' )
372
372
assert_match ( /Proxy-Authorization: Digest/ , str )
373
373
assert_match ( %r"response=\" #{ response } \" " , str )
@@ -398,7 +398,7 @@ def test_prefer_digest_to_basic_proxy_auth
398
398
ha1 = md5 . hexdigest ( "admin:foo:admin" )
399
399
ha2 = md5 . hexdigest ( "GET:/" )
400
400
response = md5 . hexdigest ( "#{ ha1 } :nonce:#{ ha2 } " )
401
- c . debug_dev = str = ''
401
+ c . debug_dev = str = '' . dup
402
402
c . get_content ( 'http://example.com/' )
403
403
assert_match ( /Proxy-Authorization: Digest/ , str )
404
404
assert_match ( %r"response=\" #{ response } \" " , str )
@@ -415,7 +415,7 @@ def test_digest_proxy_auth_reuses_credentials
415
415
ha2 = md5 . hexdigest ( "GET:/" )
416
416
response = md5 . hexdigest ( "#{ ha1 } :nonce:#{ ha2 } " )
417
417
c . get_content ( 'http://www1.example.com/' )
418
- c . debug_dev = str = ''
418
+ c . debug_dev = str = '' . dup
419
419
c . get_content ( 'http://www2.example.com/' )
420
420
assert_match ( /Proxy-Authorization: Digest/ , str )
421
421
assert_match ( %r"response=\" #{ response } \" " , str )
@@ -437,19 +437,19 @@ def test_oauth
437
437
c . www_auth . oauth . set_config ( 'http://photos.example.net/' , config )
438
438
c . www_auth . oauth . challenge ( 'http://photos.example.net/' )
439
439
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
440
- c . debug_dev = str = ''
440
+ c . debug_dev = str = '' . dup
441
441
c . get_content ( 'http://photos.example.net/photos' , [ [ :file , 'vacation.jpg' ] , [ :size , 'original' ] ] )
442
442
assert ( str . index ( %q(GET /photos?file=vacation.jpg&size=original) ) )
443
443
assert ( str . index ( %q(Authorization: OAuth realm="http://photos.example.net/", oauth_consumer_key="dpf43f3p2l4k3l03", oauth_nonce="kllo9940pd9333jh", oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1191242096", oauth_token="nnch734d00sl2jdk", oauth_version="1.0") ) )
444
444
#
445
445
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
446
- c . debug_dev = str = ''
446
+ c . debug_dev = str = '' . dup
447
447
c . get_content ( 'http://photos.example.net/photos?file=vacation.jpg&size=original' )
448
448
assert ( str . index ( %q(GET /photos?file=vacation.jpg&size=original) ) )
449
449
assert ( str . index ( %q(Authorization: OAuth realm="http://photos.example.net/", oauth_consumer_key="dpf43f3p2l4k3l03", oauth_nonce="kllo9940pd9333jh", oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1191242096", oauth_token="nnch734d00sl2jdk", oauth_version="1.0") ) )
450
450
#
451
451
c . test_loopback_http_response << "HTTP/1.0 200 OK\n Content-Length: 2\n \n OK"
452
- c . debug_dev = str = ''
452
+ c . debug_dev = str = '' . dup
453
453
c . post_content ( 'http://photos.example.net/photos' , [ [ :file , 'vacation.jpg' ] , [ :size , 'original' ] ] )
454
454
assert ( str . index ( %q(POST /photos) ) )
455
455
assert ( str . index ( %q(Authorization: OAuth realm="http://photos.example.net/", oauth_consumer_key="dpf43f3p2l4k3l03", oauth_nonce="kllo9940pd9333jh", oauth_signature="wPkvxykrw%2BBTdCcGqKr%2B3I%2BPsiM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1191242096", oauth_token="nnch734d00sl2jdk", oauth_version="1.0") ) )
@@ -479,7 +479,7 @@ def test_negotiate_and_basic
479
479
c . test_loopback_http_response << %Q(HTTP/1.1 401 Unauthorized\r \n WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAAAAACgAAAABAAAAAAAAAAAAAAA=\r \n Connection: Keep-Alive\r \n Content-Length: 0\r \n \r \n )
480
480
c . test_loopback_http_response << %Q(HTTP/1.0 200 OK\r \n Connection: Keep-Alive\r \n Content-Length: 1\r \n \r \n a)
481
481
c . test_loopback_http_response << %Q(HTTP/1.0 200 OK\r \n Connection: Keep-Alive\r \n Content-Length: 1\r \n \r \n b)
482
- c . debug_dev = str = ''
482
+ c . debug_dev = str = '' . dup
483
483
c . set_auth ( 'http://www.example.org/' , 'admin' , 'admin' )
484
484
# Do NTLM negotiation
485
485
c . get ( 'http://www.example.org/foo' )
@@ -488,7 +488,7 @@ def test_negotiate_and_basic
488
488
assert_match ( %r(Authorization: NTLM) , str )
489
489
assert_not_match ( %r(Authorization: Basic) , str )
490
490
# ditto for other resource that is protected with NTLM
491
- c . debug_dev = str = ''
491
+ c . debug_dev = str = '' . dup
492
492
c . get ( 'http://www.example.org/foo/subdir' )
493
493
assert_not_match ( %r(Authorization: NTLM) , str )
494
494
assert_not_match ( %r(Authorization: Basic) , str )
0 commit comments