Skip to content
Browse files

Add user-Agent to header because some tracker need it.

  • Loading branch information...
1 parent e8093aa commit 8f2821d1754afacb4230e818cdd92e3af3b95c73 @dufoli dufoli committed with alanmcgovern
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/MonoTorrent/MonoTorrent.Client/Tracker/HTTPTracker.cs
View
4 src/MonoTorrent/MonoTorrent.Client/Tracker/HTTPTracker.cs
@@ -85,6 +85,7 @@ public override void Announce(AnnounceParameters parameters, object state)
{
Uri announceString = CreateAnnounceString(parameters);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(announceString);
+ request.UserAgent = MonoTorrent.Common.VersionInfo.ClientVersion;
request.Proxy = new WebProxy(); // If i don't do this, i can't run the webrequest. It's wierd.
RaiseBeforeAnnounce();
BeginRequest(request, AnnounceReceived, new object[] { request, state });
@@ -291,7 +292,8 @@ public override void Scrape(ScrapeParameters parameters, object state)
else
url += "&info_hash=" + parameters.InfoHash.UrlEncode ();
- WebRequest request = WebRequest.Create(url);
+ HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+ request.UserAgent = MonoTorrent.Common.VersionInfo.ClientVersion;
BeginRequest(request, ScrapeReceived, new object[] { request, state });
}
catch

0 comments on commit 8f2821d

Please sign in to comment.
Something went wrong with that request. Please try again.