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

Encounter ssl 60 error when curl_cffi + BrightData proxy manager #417

Open
pgshow opened this issue Oct 25, 2024 · 4 comments
Open

Encounter ssl 60 error when curl_cffi + BrightData proxy manager #417

pgshow opened this issue Oct 25, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@pgshow
Copy link

pgshow commented Oct 25, 2024

Describe the bug
I am using BrightData proxy manager. curl_cffi doesn't work with the below code.
It encounter error: Failed to perform, curl: (60) SSL: no alternative certificate subject name matches

this below code, requests part works with verify=False, but cffi_requests deosn't.

import os
import time
import requests
from curl_cffi import requests as cffi_requests
from curl_cffi import Curl

proxies = {'http': 'http://149.28.250.62:24000', 'https': 'https://149.28.250.62:24000'}


headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.33',
}

r1 = requests.get('https://lumtest.com/myip.json', headers=headers, proxies=proxies, verify=False)

print('requests')
print(r1.text)
print(r1.status_code)

time.sleep(3)

r2 = cffi_requests.get('https://lumtest.com/myip.json', headers=headers, proxies=proxies, verify=False)

print('curl_cffi requests')
print(r2.text)
print(r2.status_code)

Versions

  • OS: Ubuntu 18
  • curl_cffi version 0.8.0
  • BrightData proxy manager

b336b30f3e3316aacc431ac4a0f0b2f4

@pgshow pgshow added the bug Something isn't working label Oct 25, 2024
@pgshow pgshow changed the title Encounter ssl 60 error when use BrightData proxy manager Encounter ssl 60 error when curl_cffi + BrightData proxy manager Oct 28, 2024
@pgshow
Copy link
Author

pgshow commented Oct 29, 2024

If I set the CurlOpt.PROXY to an HTTP proxy, then curl_cffi can connect to my ProxyManager server, but the fingerprint is gone.

from curl_cffi import Curl, CurlOpt, requests

proxies = {'http': 'http://149.28.250.62:24000', 'https': '149.28.250.62:24000'}

# 初始化 Curl 对象
curl = Curl()
curl.setopt(CurlOpt.URL, "https://httpbin.org/ip")
curl.setopt(CurlOpt.SSL_VERIFYPEER, 0)  # 关闭对服务器证书的验证
curl.setopt(CurlOpt.SSL_VERIFYHOST, 0)  # 关闭对主机名的验证
curl.setopt(CurlOpt.PROXY, proxies['http'])  # 设置代理

# 执行请求
curl.perform()

0de766bc57320e6167221a3bb2e4fa5c

ff7d0309402a4ffb1f277be1b0864dbc

@perklet
Copy link
Collaborator

perklet commented Oct 29, 2024

It seems that you ignored the warning messages. Make sure you read through #6.

@pgshow
Copy link
Author

pgshow commented Oct 29, 2024

Yes, I am using curl.setopt to debug ,so there is no warning message.

when I used {'https': 'http://gw.dataimpulse.com:823'} as the proxy, akamai_hash works. but {'https': 'http://149.28.250.62:24017'} doesn't.
I think ProxyManger wraps the request on their software themselves so that akamai_hash is gone.
Let me ask them.

@pgshow
Copy link
Author

pgshow commented Oct 29, 2024

After I deactivated the SSL on ProxyManger, and used the {'https': 'http://149.28.250.62:24017'} as the proxy, the fingerprint is back. So I am sure the curl_cffi and ProxyManger SSL have a conflict.

0c22abb63ab16ff4a3e54c4559272dca

ddab82eb65797d3b60f8594263cb6e6c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants