D
D
DuD2014-01-13 23:08:11
Python
DuD, 2014-01-13 23:08:11

How to overcome The server name sent was not recognized (pycurl)?

Welcome all.
I stumbled upon a strange oddity. The python script crashes with a segmentation fault. As a result of the analysis, I came to the conclusion that this happens on sites using an SSL certificate in which their domain is not registered.
And it seems that the solution is obvious, turn off the check and it's ready, but for some reason this did not save me.
The script crashes with the message:
Process finished with exit code 139
Reduced the code as much as possible:

import pycurl

c = pycurl.Curl()
c.setopt(c.URL, 'http://bulllat.ru/')
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.SSL_VERIFYPEER, 0)
c.setopt(pycurl.SSL_VERIFYHOST, 0)
c.perform()

This code returns:
pycurl.error: (51, 'gnutls_handshake() warning: The server name sent was not recognized') I'm not quoting
the URL by chance, don't take it as advertising. It's just that not on every site with SSL the script stumbles.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mysticmirage, 2014-01-14
@DuD

Add before c.perform():
PS More
correctly:
instead of:
c.setopt(c.URL, 'http://bulllat.ru/')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question