Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SSL/TLS Issue #7

Merged
merged 1 commit into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PaheScrapper/Helpers/WebErrorReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace PaheScrapper.Helpers
{
public static class WebErrorReporter
{
public static void HttpError(WebResponse webResponse)
public static void WebException(WebException webException)
{
LogWriter lw = new LogWriter("Http Dump: \n" + JsonConvert.SerializeObject(webResponse));
LogWriter lw = new LogWriter("Web Exception Dump: \n" + JsonConvert.SerializeObject(webException));
}

public static void HtmlError(HtmlDocument htmlDocument)
Expand Down
5 changes: 5 additions & 0 deletions PaheScrapper/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using PaheScrapper.Helpers;
using PaheScrapper.Properties;
Expand All @@ -19,6 +20,10 @@ static void Main(string[] args)

ScrapperWeb.ReleaseGarbageScrape();

/*Fix SSL/TLS Problem*/
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

if (args.Length == 0)
FullScrape();
else
Expand Down
4 changes: 2 additions & 2 deletions PaheScrapper/ScrapperWeb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static HtmlDocument GetDownloadHtml(string url, WebRequestHeader header)
}
catch (WebException e)
{
WebErrorReporter.HttpError(e.Response);
WebErrorReporter.WebException(e);
throw new ScrapperDownloaderException("Cannot Get Response.", e);
}

Expand Down Expand Up @@ -96,7 +96,7 @@ public static HtmlDocument PostDownloadHtml(string url, Dictionary<string, strin
}
catch (WebException e)
{
WebErrorReporter.HttpError(e.Response);
WebErrorReporter.WebException(e);
throw new ScrapperDownloaderException("Cannot Get Response.", e);
}

Expand Down