GitHub user mlaponder opened a pull request: https://github.com/apache/cordova-plugin-file-transfer/pull/90
Fix/wp8 browser cookies [wp8] Make it possible to use the webview's cookiestore to do HTTP requests On the wp8 platform, cookies used to be always copied from the webview when performing a request. However, only the cookies for the currently loaded URL could be copied. This made it impossible to pass cookies cross-origin. This commit introduces a flag `useBrowserHttp` which when `false` keeps the same behavior. When `true`, it creates the WebRequest through a different factory method, reusing the cookies of the webview. Using this option comes at a price though: it makes it impossible to add cookies manually by setting headers and it can't perform GET requests with headers set. Therefore this functionality is put behind a flag. Because we had to change the API between the JS and native code to add the flag, this commit also includes platform changes. Code was tested on ios, android and wp8 platforms. Co-Authored-By: Leroy van Engelen <leroy.van.enge...@mendix.com> You can merge this pull request into a Git repository by running: $ git pull https://github.com/mlaponder/cordova-plugin-file-transfer fix/wp8-browser-cookies Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-file-transfer/pull/90.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #90 ---- commit fc1a60c0ee8c049c1d659ee275bbf3ced8c0a682 Author: Marco Laponder <marco.lapon...@mendix.com> Date: 2015-06-15T14:15:29Z Add useBrowserHttp argument to native interfaces commit c70c3aa8b94d8e87f525d66ecdd1888b69b66fd1 Author: Marco Laponder <marco.lapon...@mendix.com> Date: 2015-06-15T14:27:40Z Use cookies directly from the webview Originally, cookies from the webview were always copied to the WebRequest. When getting the cookies from the webiew only those for the current URL can be retrieved. This means that cookies of other domains were never copied to the WebRequest for upload and download. This commit adds the option to use a HTTP request constructed by the webview, which automatically adds any available cookies for that request. Fixed by using the BrowserHttp implementation of IWebRequestCreate which shares the cookie store with the webview. See also http://stackoverflow.com/questions/4212713/grabbing-cookies-in-web-browser-control-wp7 This functionality is enabled by a new useBrowserHttp flag. We need this to be optional because: - It removes the possibility of adding cookie headers manually - It makes it impossible to perform GET requests with manually set headers commit 78d216a94e02a15faee81b008aa4662151344b3b Author: Marco Laponder <marco.lapon...@mendix.com> Date: 2015-06-15T14:55:30Z Move Uri exception handling to outer catch block This will make it easier to unify the WebRequest creation code later. commit 58fcc98e7ffa79650d2900c8d16cbea1a19c3d77 Author: Marco Laponder <marco.lapon...@mendix.com> Date: 2015-06-15T14:56:50Z Use an Uri to create WebRequest in download as well commit e63d707445d0c03a4b0065e5e5d11a7d4e978896 Author: Marco Laponder <marco.lapon...@mendix.com> Date: 2015-06-15T15:06:22Z Extract WebRequest creation Share the WebRequest creation code between download and upload. commit fdaa1cf5a8df18fd0f2a8feefe90d54babbbc457 Author: Marco Laponder <marco.lapon...@mendix.com> Date: 2015-06-16T11:34:02Z Add documentation for `useBrowserHttp` ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org