Back-port fixes 2c6e877 & bbff814 for httpcomponents-client 4.2