fix thread affinity/invoke and cancellation issues in http client.