|
最近想要归队 MJ12,不料每次都发现 SSL Test 失败。一怒之下拿出 ILSpy 全都反编译个遍,才发现 NodeLib 里的 Majestic12.WebCrawler.TestSSL 强行硬编码了 Google 的 robots.txt 做测试。- // Majestic12.WebCrawler
- // Decomplied Using ILSpy, Copyright (c) Majestic-12 Ltd.
- private bool TestSSL()
- {
- string sURL = "https://www.google.com/robots.txt";
- string text = Utils.ResolveDirectory("ssltest.tmp");
- bool result;
- try
- {
- Utils.Delete(text);
- try
- {
- WebHeaderCollection webHeaderCollection;
- Utils.GetURL(sURL, text, this.WEB_CRAWLER_USER_AGENT, false, out webHeaderCollection, false, false, 15, false, this.oMJ12nodeLib.oConfig.Connection.UseProxyForCrawlingOnly);
- }
- catch (Exception ex)
- {
- Utils.WriteLine("SSL test failed: {0}", new object[]
- {
- ex.Message
- });
- result = false;
- return result;
- }
- if (File.Exists(text))
- {
- string text2 = Utils.LoadFromFile(text).Trim().ToLower();
- if (!text2.Contains("user-agent"))
- {
- Utils.WriteLine("SSL test failed: have not found expected text in file {0}", new object[]
- {
- text
- });
- result = false;
- }
- else
- {
- Utils.Delete(text);
- result = true;
- }
- }
- else
- {
- Utils.WriteLine("SSL test failed: file {0} does not exist", new object[]
- {
- text
- });
- result = false;
- }
- }
- catch (Exception ex2)
- {
- Utils.WriteLine("SSL test failed, reason: {0}", new object[]
- {
- ex2.Message
- });
- result = false;
- }
- return result;
- }
复制代码 考虑到这是 SSL,Hosts 糊弄到百度之类的看来是不可能了,只能等我非法地编译回去改一下了……
cc @StephDC
|
|