Commit Graph

2705 Commits

Author SHA1 Message Date
Cédric Luthi
038eee9aa5 Remove superfluous NSStringFromClass calls 2016-10-07 16:08:14 +02:00
Kevin Harwood
748a410ba7 Fixed bug with webview delegate callback 2016-10-06 10:13:24 -05:00
Kevin Harwood
2d1fb6ba7a Fixed issue where response serializers did not inherit super class copying 2016-10-06 08:38:54 -05:00
Cédric Luthi
a26a500c1d Make it impossible to set a security policy with pinning on insecure URLs
### Before this commit
Setting a security policy configured with `AFSSLPinningModeCertificate` or `AFSSLPinningModePublicKey` on a AFHTTPSessionManager instance configured with an insecure `http` base URL was valid. Requests made with this manager would always succeed since the `-[AFURLSessionManager URLSession:didReceiveChallenge:completionHandler:]` would never be called and thus the security policy would never be evaluated.

### After this commit
Setting a security policy configured with `AFSSLPinningModeCertificate` or `AFSSLPinningModePublicKey` on a AFHTTPSessionManager instance configured with an insecure `http` base URL will throw an exception. This will force the manager to be configured with a secure `https` URL.

Note that properly configuring App Transport Security (ATS) would also solve this issue since insecure connections would fail anyway, but this is a *belt and suspenders* solution.
2016-10-06 08:27:21 -05:00
Kevin Harwood
e337471d80 Disabling background manager tests for Xcode 8 due to rdar://28588583 2016-10-05 13:15:09 -05:00
Kevin Harwood
51561a9236 Removed code signing for test targets
Trying `FASTLANE_EXPLICIT_OPEN_SIMULATOR=1`
2016-10-05 13:15:09 -05:00
Kevin Harwood
a81d445a00 Updated travis matrix based on upcoming image support changes 2016-10-05 13:15:09 -05:00
Kevin Harwood
89b79c53a0 Xcode 8 Compatibility for Travis CI
- Updated Test Runners for Travis
- Updated project settings for Xcode 8
- Updated macOS example platform
2016-10-05 13:15:09 -05:00
Cédric Luthi
a8c148f9df Extract common URLs into AFTestCase
There was some repetition in URL creation for unit tests. Extracting the common URLs (png, jpeg, delay, status code) makes it easier run the test suites on a local copy of httpbin with the `python -m httpbin.core` command.
2016-10-05 09:38:33 -05:00
Kevin Harwood
dd674a3268 Merge pull request #3718 from 0xced/fix-potential-KVO-crasher
Fixed potential KVO crasher for URL Session Task delegates
2016-10-03 08:46:50 -05:00
Cédric Luthi
2163a8b750 Do not dispatch session invalidation on the main thread
The dispatching on main thread was introduced in 920e2669f9 in order to fix #2053. It was not a proper fix but rather a lucky coincidence. This kind of KVO error must be fixed by ensuring that observer are properly registered and unregistered, not by dispatching some random method on the main thread.

It is very important not to dispatch async session invalidation code because it is called in unit tests from the `tearDown` method. At that point, there’s no active runloop, so the session invalidation would not happen immediately but when running the next asynchronous unit test, i.e. when the `waitForExpectationsWithCommonTimeoutUsingHandler:` method is called.

This commit, in conjunction with d869571b82 fixes #3710.
2016-09-30 23:52:29 +02:00
Cédric Luthi
d869571b82 Safer KVO implementation in AFURLSessionManagerTaskDelegate
Adding self as observer in init and removing self as observer in dealloc is the best way to ensure a proper KVO implementation.
2016-09-30 23:32:39 +02:00
Kevin Harwood
4fb051898c Merge pull request #3693 from 0xced/fix-progress-handlers
Fix progress handlers called with fractionCompleted == 1 several times
2016-09-23 08:07:15 -05:00
Cédric Luthi
cd5cd6e787 Fix progress handlers called with fractionCompleted == 1 several times
Setting the expectation to nil after it is fulfilled in order to avoid `*** Assertion failure in -[XCTestExpectation fulfill]` was just hiding the real issue.
2016-09-23 14:33:25 +02:00
Kevin Harwood
6aa6a3b7ed Merge pull request #3692 from 0xced/disable-reachability-test
Disable another domain reachability test for Travis stability
2016-09-22 15:59:29 -05:00
Kevin Harwood
bcba777cfa Merge pull request #3691 from 0xced/fix-fastlane-bundler-issues
Fix Travis build failures because of fastlane/bundler error
2016-09-22 15:59:16 -05:00
Cédric Luthi
f235558c69 Disable another domain reachability test for Travis stability 2016-09-22 22:26:08 +02:00
Cédric Luthi
51b17804ee Fix Travis build failures because of fastlane/bundler error
Workaround a bundler issue which is tracked on https://github.com/bundler/bundler/pull/4981
2016-09-22 22:20:03 +02:00
Kevin Harwood
137676251b Merge pull request #3649 from Microbee23/bug/reachability-ns-unavailable
Fixed issue where `NS_UNAVAILABLE` is not reported for `AFNetworkReachabilityManager`
2016-09-19 10:37:02 -05:00
Joseph Granieri
712ac61a4f Fixed issue where NS_UNAVAILABLE is not reported to calling code as it was previously just in the .m file - this allows the compiler to generate a build error when using the init method 2016-08-17 14:46:14 +10:00
Kevin Harwood
f51f0b8533 Merge pull request #3565 from chenxin0123/cx
Moved `[self didChangeValueForKey:@"currentState"]` into correct scope
2016-08-03 08:12:55 -05:00
Kevin Harwood
fdb2d14f0f Merge pull request #3604 from Starscream27/uiprogressview-completed-crash
Fixed an issue where registering a UIProgessView to a task that was a…
2016-08-03 08:06:50 -05:00
Kevin Harwood
ff228fad3a Merge pull request #3607 from wikimedia/bug/kvo-progress-removal
Remove KVO of progress in favor of using the NSURLSession delegate APIs
2016-08-03 07:55:18 -05:00
Kevin Harwood
18a7973839 Merge pull request #3612 from ethansinjin/master
require app extension api only on watchOS
2016-08-03 07:41:50 -05:00
Ethan Gill
1e27113c8b require app extension api only on watchOS 2016-07-14 17:51:24 -07:00
Corey Floyd
9aa03d0f96 Remove KVO of progress in favor of using the NSURLSession delegate APIs
The impetus for this change was a bug related to:
https://github.com/AFNetworking/AFNetworking/issues/3380

Which points to an issue where AFURLSessionManager could get in a state where it does not inform the AFURLSessionManagerTaskDelegate to un-observe cancelled (or otherwise completed) tasks before they are deallocated.
While the above issue is specific to background tasks/sessions, we have observed it on sessions with default configurations as well.

Instead of debugging the KVO issues, I decided to replace the KVO code with in favor of the appropriate NSURLSession delegate methods.
Running all unit tests shows that this approach appears to be working.

The pull request that made this change (https://github.com/AFNetworking/AFNetworking/pull/3187) mentions that its goal was to remove the need for AFNetworking API consumers to use a KVO API for getting progress.
This makes sense, but I was unable to see any reason why KVO was used internally for getting progress information rather than the NSURLSession Delegate methods.
Because of this, It isn't clear to me what the historical reasons were/are for KVO being needed to satisfy the progress requirements of the AFNetworking API.

With any luck, KVO is no longer needed and we can eliminate this class of crashes by eliminating KVO.
2016-07-06 13:05:23 -04:00
Mathieu Meylan
7dc973b89c Fixed an issue where registering a UIProgessView to a task that was already completed would crash with the following error:
CRASH: Fatal exception: An instance ***** of class ******* was deallocated while key value observers were still registered with it.
2016-07-05 17:01:53 +02:00
CX
023f3505c8 move [self didChangeValueForKey:@"currentState"]; into if scope 2016-06-11 20:04:48 +08:00
Kevin Harwood
2a53b2c3f4 Merge pull request #3526 from alexbird/bugs/header-threading-crash
Fixed crashes due to race conditions with NSMutableDictionary access in AFHTTPRequestSerialiser
2016-06-06 13:07:39 -05:00
Kevin Harwood
363a1fcc20 Merge pull request #3555 from hulizhen/master
Update README.md
2016-06-06 09:12:06 -05:00
Kevin Harwood
ac2af11551 Merge pull request #3504 from Coeur/patch-2
documenting the workaround to uploadTaskWithRequest:fromFile: bug
2016-06-06 07:56:40 -05:00
Hu Lizhen
f26bfb46c3 Update README.md
Update the content of the section `Installation with CocoaPods` in `README.md`.
2016-06-04 09:35:13 +08:00
Alex Bird
0e46d1ea89 Fix for crashes due to dangerous NSMutableDictionary access in AFHTTPRequestSerialiser – Moved unit test to a better location. 2016-05-19 22:35:49 +01:00
Alex Bird
fa8b02da94 Fix for crashes due to dangerous NSMutableDictionary access in AFHTTPRequestSerialiser – Added unit test which reproduces the issue.
NB: as the crash is caused by using a dictionary in a way that the runtime did not expect, it typically causes intermittent crashes which are almost always in unrelated areas of the app. This seems to be strongly related to deallocation of the values in the dictionary, but this may not be the only cause. As such, there is nothing to positively test for, the test succeeds if it doesn't EXC_BAD_ACCESS when cleaning up the @autoreleasepool at the end.
2016-05-19 22:27:21 +01:00
Antoine Cœur
27652fe03e documenting the workaround to uploadTaskWithRequest:fromFile: bug 2016-05-12 14:33:25 +08:00
Kevin Harwood
59d5111895 Merge pull request #3490 from dchohfi/deprecating-method
Added deprecated attribute to  `dataTaskWithRequest:completionHandler:`
2016-05-06 09:15:40 -05:00
Kevin Harwood
e1e2d62ad8 Merge pull request #3476 from ecaselles/ecaselles-update-methods-override-documentation
Updates `AFHTTPSessionManager` documentation to reflect v3.x changes
2016-05-06 09:14:14 -05:00
Kevin Harwood
3eec2c1f0f Merge pull request #3488 from gemmakbarlow/master
Updated character
2016-05-06 08:50:30 -05:00
Diego Chohfi
11c049a083 Fixing unit tests for deprecated method 2016-05-03 12:23:17 -03:00
Diego Chohfi
c0131a92a1 Deprecating method dataTaskWithRequest:completionHandler: from AFURLSessionManager 2016-05-03 11:53:11 -03:00
Gemma Barlow
0cac3e4bfc Updated character
Updated to a different unicode dash (U+002D rather than U+2013) so that it is parsed correctly by markdown, when converting the CocoaPods Acknowledgements.markdown to HTML.
2016-05-01 17:29:32 -04:00
Edu Caselles
711aeec616 Updates documentation to reflect the new behaviour on GET, POST, etc. convenience methods. 2016-04-28 16:24:56 +01:00
Kevin Harwood
b7073e4990 Merge pull request #3431 from 0xced/warnings
Improved code base to generate fewer warnings when using strictor compiler settings
2016-04-11 13:34:50 -05:00
Kevin Harwood
df039898bb Merge pull request #3432 from yulingtianxia/master
remove unused `AFTaskStateChangedContext`
2016-04-11 13:28:24 -05:00
yulingtianxia
60ad370c8f remove unused AFTaskStateChangedContext
`AFTaskStateChangedContext` is not used in AFN 3
2016-04-09 17:45:48 +08:00
Cédric Luthi
885e0a4b4e Enable more warnings 2016-04-09 01:06:05 +02:00
Cédric Luthi
19e4aef45c Enable Treat Warnings as Errors 2016-04-09 00:41:38 +02:00
Cédric Luthi
4a7148db79 Comment out unused static functions
They were referenced in testPolicyWithCertificatePinningAllowsGoogleComServerTrustIncompleteChainWithRootCertificatePinnedAndValidDomainName which is now disabled.
2016-04-09 00:41:38 +02:00
Cédric Luthi
c52ff8510f Remove unnecessary #pragma clang diagnostic ignored 2016-04-09 00:41:38 +02:00
Cédric Luthi
16c09fae46 Remove all #pragma clang diagnostic ignored "-Wgnu" 2016-04-08 23:46:10 +02:00