Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I was using RestSharp as an HttpClient in my code. But because of the requirement of moving my code to PCL, I had to move to HttpClient. Everything works fine but lately realized that the default behavior that used to work with RestSharp is not working with HttpClient.
***Problem: By setting the WiFi proxy from my iPhone (http://www.ibvpn.com/billing/knowledgebase/72/How-to-configure-proxy-usage-for-iphoneipad.html) and if I launch my app that makes an Http call, I could able to see the requests happening in Charles client. This is happening well with RestSharp but fails with HttpClient.
Please find the attached sample that has 2 projects, NonPCL.core and CCube.Core projects that generates NonPCL .dll using RestSharp to make an Http call and PCL .dll using HttpClient to make an Http call. Both attempts to fetch the contents of bing.com and displays in the textview.
***How to integrate PCL(HttpClient)/NonPCL(RestSharp) version.
1. Provide manual proxy in iPhone over wifi. (http://www.ibvpn.com/billing/knowledgebase/72/How-to-configure-proxy-usage-for-iphoneipad.html).
2. Relaunch/Launch charles.app.
3. From the sample, CoreTest, provide the reference for CCube.Core (PCL).dll to use HttpClient to make http call.
4. Execute the iPhone project.
5. Charles will ask for permission to Allow the phone to access and Allow to show logs.
Follow the same for NonPCL.core project for Step 3.
***Observation: NonPCL(RestSharp) versioned Http Request will be logged inside Charles.app whereas PCL(HttpClient) fails.
Am I missing anything here. Kindly help me on the same.
Sample Url: http://tinyurl.com/HttpClientVsRestSharp-Proxy
You have to configure the proxy for HttpClient manually, it will not pick up the system proxy by default.
See here: http://stackoverflow.com/a/23678569/183422
That works fine. But here is the catch.
I want to use native HttpClient like NSUrlSessionHandler() for iOS and OkHttpNetworkHandler for Android rather than generic HttpClientHandler. And unfortunately neither of the native HttpClients has Proxy field to set the proxy as I did for HttpClientHandler.
Is it a bug that Neither of the Native HttpClients has Proxy field and not even HttpMessageHandler which is the base class for both Native HttpClient (NSUrlSessionHandler, OkHttpNetworkHandler) and HttpClientHandler.
Is there any other way that I can set the Proxy in this case?
Are you referring to NSUrlSessionHandler/OkHttpNetworkHandler as shipped by the ModernHttpClient component (https://components.xamarin.com/view/modernhttpclient)?
Then you must contact the provider of the ModernHttpClient component, there's a website link here you can try: https://components.xamarin.com/view/modernhttpclient