Dduvall has uploaded a new change for review. https://gerrit.wikimedia.org/r/235390
Change subject: [WIP] Fix cookie jar domain bug ...................................................................... [WIP] Fix cookie jar domain bug Working on debugging scenario where non-domain cookies are not sent in subsequent responses to invalid cookie domains (e.g. 'http://dev/'). Implemented a test to simulate the errant behavior. Bug: T111133 Change-Id: Ice562fefdda93d1d9935e9166720e8328684c968 --- M spec/client_spec.rb 1 file changed, 24 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/ruby/api refs/changes/90/235390/1 diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 64aaf21..a22d7d6 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -191,6 +191,30 @@ expect(request).to have_been_requested end end + + context 'following a request to an invalid cookie domain' do + let(:client) { MediawikiApi::Client.new('http://dev/w/api.php') } + + context 'where the response sets a non-domain cookie' do + before do + stub_request(:post, 'http://dev/w/api.php'). + with(body: { action: 'foo', format: 'json' }). + to_return(body: {}.to_json, headers: { 'Set-Cookie' => 'session=1; path=/; HttpOnly' }) + + client.action(:foo, token_type: false) + end + + it 'should still send the cookie in subsequent requests' do + @request_with_cookie = stub_request(:post, 'http://dev/w/api.php'). + with(body: { action: 'bar', format: 'json' }, headers: { 'Cookie' => 'session=1' }). + to_return(body: {}.to_json) + + client.action(:bar, token_type: false) + + expect(@request_with_cookie).to have_been_requested + end + end + end end describe '#log_in' do -- To view, visit https://gerrit.wikimedia.org/r/235390 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice562fefdda93d1d9935e9166720e8328684c968 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/ruby/api Gerrit-Branch: master Gerrit-Owner: Dduvall <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
