mirror of
https://github.com/ushahidi/SMSSync.git
synced 2026-04-26 00:05:57 +03:00
[GH-ISSUE #433] HTTP requests may be made to wrong URL #304
Labels
No labels
Bug report
Code improvement
Concern
Feature request
Feature request
Good first issue to work on
In progress
Needs info
Question
Ready
Translation
User Experience
User Experience
Website
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SMSSync#304
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alxndrsn on GitHub (Apr 8, 2016).
Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/433
Both HTTP client implementations in the codebase,
AppHttpClientandMessageHttpClient, depend on the same base class,BaseHttpClient.Usage
MessageHttpClientMessageHttpClientis mostly used inPostMessage.PostMessageis a singleton, and maintains a single reference toMessageHttpClient.AppHttpClientThis class is mostly used by
ProcessMessageResult, which is also a singleton and maintains a single reference toAppHttpClient.The Problem
BaseHttpClientstores the URL to be contacted in a class property, which is done at various places:This value is then read later in
BaseHttpClient.execute()(inprepareRequest()).In the intervening time between
BaseHttpClient.mUrlbeing set insetUrl(), and being read inexecute(), its value may have changed on another thread.I had initially missed that both HTTP client classes are declared as singletons:
This presumably means that a single instance is shared wherever DI is used (which seems currently to cover all uses of these classes).
@eyedol commented on GitHub (Apr 22, 2016):
@alxndrsn I really don't understand this. Could you be clear on what needs changing or fixing? I need coffee :-)
@alxndrsn commented on GitHub (Apr 22, 2016):
I think the simplest fix would be to use a fresh instance of
MessageHttpClient/AppHttpClientfor each request.@eyedol commented on GitHub (Apr 27, 2016):
Got it