0

I have an issue with sending a request to the website. I am using the "hentai" library to make a useful telegram bot with nhentai API on Python (don't judge please). Why do I get this error on Linux (Ubuntu)?

:~$ curl -v https://nhentai.net
* Expire in 0 ms for 6 (transfer 0x55c3a8516530)
  ...
* Expire in 9 ms for 1 (transfer 0x55c3a8516530)
*   Trying 104.27.195.88...
* TCP_NODELAY set
* Expire in 149985 ms for 3 (transfer 0x55c3a8516530)
* Expire in 200 ms for 4 (transfer 0x55c3a8516530)
* Connected to nhentai.net (104.27.195.88) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to nhentai.net:443
* Closing connection 0
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to nhentai.net:443
wovano
  • 4,543
  • 5
  • 22
  • 49
Ulxn
  • 13
  • 2
  • Is it maybe due to an expired certificate? Check out this [post](https://stackoverflow.com/questions/69387175/git-for-windows-ssl-certificate-problem-certificate-has-expired) – AloneTogether Oct 15 '21 at 13:27
  • @AloneTogether: curl has not even received a certificate for validation yet, so this is not the problem. The error message is also clearly different from what is the problem in the other post. – Steffen Ullrich Oct 15 '21 at 16:52

2 Answers2

1

My guess is that there is something in the middle, like a local antivirus or parental control software or some company/school middlebox/firewall which does not like the name of the website you are trying to access.

What you see is typical for DPI solutions which allow the initial TCP connect but then cause a connection close once they detect the domain name you are connecting to (which is contained in the TLS handshake ClientHello)

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • I got it. I will try to send -GET request to the same domain, but in another server to check if it's cause of firewall/security or something, Thanks! – Ulxn Oct 16 '21 at 08:34
  • Thanks! I guess it's cause of ubuntu settings or something like security/firewall/etc. I googled this problem, a lot of ppl said that its cause of cipher or something. Like the nhentai website uses old cipher in server or something like this. I tested the code in another server(heroku) and it worked well! I will keep it in heroku btw, but I wanna know the cause of this problem. Dont you know the cause? Provider: netangels.ru – Ulxn Oct 16 '21 at 09:44
  • 1
    @Ulxn: Unfortunately just mentioning the provider does not help in knowing your setup. But given that your client tries TLS 1.3 it means that it is using a modern TLS stack. The target you are trying to reach is behind Cloudflare which has a modern TLS stack too which is also configured to accept a very wider variety of new and older TLS clients. So problems with the cipher are very unlikely and the servers certificate is also properly setup. – Steffen Ullrich Oct 16 '21 at 12:15
0

I tried with curl and python's request library on the site you mentioned and pulled the desired content. Make sure that the curl on your linux machine is working properly. If you want, you can try the simple code below.

import requests

myrequest = requests.get("https://nhentai.net/")

print(myrequest.text)
Tpeng
  • 11
  • 2
  • Output: raise ConnectionError(err, request=request) \ requests.exceptions.ConnectionError: ('Connection aborted.', OSError(0, 'Error')) I guess there is a problem with server or there is something kinda security/firewall/black-list-of-sites that blocks nhentai.net. Because the requests to nhentai.net works well in another server(heroku) – Ulxn Oct 16 '21 at 09:49
  • I agree. I made several requests and they were successful. but then the server didn't respond to my requests. – Tpeng Oct 16 '21 at 11:40