New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add default HTTP User-Agent for specific system #2409
Add default HTTP User-Agent for specific system #2409
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2409 +/- ##
=========================================
- Coverage 75.09% 75% -0.09%
=========================================
Files 36 36
Lines 3895 3905 +10
=========================================
+ Hits 2925 2929 +4
- Misses 970 976 +6
Continue to review full report at Codecov.
|
User-Agent it's just a HTTP header. For 4.x, use headersFilter instead. For 5.x, use requestModifier instead. We should not bind complicated business code to a common library. If the user desired to use something, we just provide a abstract protocol or way to let them provide the information. |
@dreampiggy It has no any business code, it just add the device and system version. just like all common user agent. you can see Like below, you can see how Apple uses the user-agent to identify the device. |
@zhongwuzw I agree we need to set the |
@bpoplauschi the propose @dreampiggy suggested is used for custom for each request, so any opinion about this |
I've looked at this PR again. Guys, I think an API like |
@bpoplauschi Emm 🤔 , |
SDWebImage/SDWebImageDownloader.m
Outdated
@@ -94,11 +94,32 @@ - (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfi | |||
_downloadQueue.maxConcurrentOperationCount = 6; | |||
_downloadQueue.name = @"com.hackemist.SDWebImageDownloader"; | |||
_URLOperations = [NSMutableDictionary new]; | |||
SDHTTPHeadersMutableDictionary *headerDictionary = [SDHTTPHeadersMutableDictionary dictionary]; | |||
NSString *userAgent = nil; | |||
#if SD_IOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems does not handle tvOS, so it's better to use SD_UIKIT
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch.
@zhongwuzw Don't need to add one extra config in |
You are right guys, I forgot about |
I see no reason to keep this un-merged. Good job @zhongwuzw |
New Pull Request Checklist
I have read and understood the CONTRIBUTING guide
I have read the Documentation
I have searched for a similar pull request in the project and found none
I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)
I have added the required tests to prove the fix/feature I am adding
I have updated the documentation (if necessary)
I have run the tests and they pass
I have run the lint and it passes (
pod lib lint
)This merge request fixes / reffers to the following issues: ...
Pull Request Description
Let's tell the server what we are. Server maybe forbidden us if he think it's not the valid request.
Don't needs to reinventing the wheel, borrow snippet from AFNetWorking.
Fixed #2408 .