Reputation: 4232
I have following problem, i use HttpWebRequest for getting some data from web inside application that uses mono. Also application uses proxy (squid without authentication). Most of requests go to https://service.domain.com and it works well, but when i try access https://data.domain.com i get 404 response.
If i swap requests and first request go to https://data.domain.com - it works, but next requests to https://service.domain.com will fail.
I have this issue only on mono with https and with proxy.
Any advices or workarounds?
Upvotes: 0
Views: 431
Reputation: 38538
If this is the same bug I noticed just last week (Friday, in fact), what I think you'll find is that the same HttpWebRequest object (or backing connection object - I never checked) is being reused, but the connection has stayed open to the old server (in your case, https://service.domain.com) and that new GET/POST invocations re-use that connection instead of forcing it to connect to data.domain.com like it should.
The way I worked around it was to set KeepAlive to false for the first server (I only made 1 request anyway) so that when I switched to my second server, it would force a reconnect (at which point I set KeepAlive back to true).
Another way might be to create 2 web requests simultaneously (one for each server) so that they don't get reused.
I should have filed this on Friday but didn't get around to it and since forgot. You just reminded me of it, so I just filed it:
https://bugzilla.xamarin.com/show_bug.cgi?id=7599
Feel free to add yourself to the Cc list and provide any additional info you think I may have missed.
Upvotes: 1