lostisland/faraday — pull request #250 by leocassarani (2013-04-01 00:33:10+00:00)
Title: Fix race conditions in Faraday::Utils::Headers

`Faraday::Utils::Headers` uses a shared `KeyMap` hash to cache symbol -> string mappings of HTTP header names. When multiple threads are writing to the cache, race conditions may occur, as the `Hash` class is not thread-safe in Ruby.

This commit adds a mutex to synchronize writes to the `KeyMap` hash. This was enough to remove the race conditions I was seeing in my multi-threaded app running on Rubinius.