{"push_id":665214887,"size":1,"distinct_size":1,"ref":"refs/heads/dup_names_hash_when_copying_header_hash","head":"5a05ea7cdb2e5ec8bd3b71cbde432ec11e8b3f60","before":"8dbba80c2960758b1bb328e864661d706e6b2f77","commits":[{"sha":"5a05ea7cdb2e5ec8bd3b71cbde432ec11e8b3f60","author":{"email":"ea442e001a5636eeee710090794bb7eb2e3459c8@redhat.com","name":"Joe Rafaniello"},"message":"Dup the `@names` hash when the Headers hash is copied.\n\nWithout this change, a connection's header and each request's header\nall reference the same `@names` hash object so any request that modified\nit via delete or other mutating methods, would affect the headers of other\nrequests and the connection.\n\nIn [travis.rb](https://github.com/travis-ci/travis.rb/blob/9b3eb05542e37b99a40ab89c0e861019664c15d7/lib/travis/client/session.rb#L206-209), it was doing:\n\n```ruby\n  connection.public_send(verb, url, *args) do |request|\n    next if request.path !~ /^https?:/ or request.path.start_with? api_endpoint\n    request.headers.delete(\"Authorization\")\n  end\n```\n\nThis caused the headers of multiple requests (and the connection) to share\nthe same `@names` hash object, resulting in `@names` and the Header hash\nto go out of sync:\n\nthing| @names | Header\n--- | --- | --- | ---\nconnection | no Authorization | Has Authorization\nrequest 1 | no Authorization | no Authorization\nrequest 2 | no Authorization | Has Authorization\n\nBecause Headers uses the `@names` to determine if it `includes?` a key or\nif there's a key to `delete`, you would have Authorization in the headers\nbut it wouldn't be removed because `@names` didn't have it.","distinct":true,"url":"https://api.github.com/repos/jrafanie/faraday/commits/5a05ea7cdb2e5ec8bd3b71cbde432ec11e8b3f60"}]}