Strumenta / SmartReader

SmartReader is a library to extract the main content of a web page, based on a port of the Readability library by Mozilla
https://smartreader.inre.me
Apache License 2.0
160 stars 36 forks source link

SecurityProtocol not specified when sending a request #10

Closed AndySchmitt closed 5 years ago

AndySchmitt commented 5 years ago

SmartReader does not specify Security Protocols after the creation of HttpClient, this causes a 502 bad gateway response from server.

I solved this problem specifying the SecurityProtocol after the creation of HttpClient:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

Here is a test case: https://girosa.com.br/politica/empresa-que-presta-servicos-em-osasco-integra-consorcio-do-lixo-investigado-pela-pf

gabriele-tomassetti commented 5 years ago

Thanks for indicating the problem.

I will try to fix it this weekend. However, security is complicated, so I will have to research first what combinations of values creates the least problems. It might take sometimes.

gabriele-tomassetti commented 5 years ago

I do not think I will fix this issue, but I have added a note about it in the README.

I think that this is the best way because any change on the property ServicePointManager.SecurityProtocol might affect also requests made by other parts of the code (see documentation). This will be unexpected and might cause weird bugs to some user of the library.