lexiforest / curl_cffi

Python binding for curl-impersonate fork via cffi. A http client that can impersonate browser tls/ja3/http2 fingerprints.
https://curl-cffi.readthedocs.io/
MIT License
2.52k stars 266 forks source link

[BUG] Setting up a get request but sending out a post request #388

Closed RachelAlucard closed 2 months ago

RachelAlucard commented 2 months ago

Describe the bug I compared the use with the requests library. While also using the get method to initiate a request with a request body, the curl_cffi library actually initiates a post request。The code is as follows:

import requests
from curl_cffi import requests as request

if __name__ == "__main__":
    url = "http://127.0.0.1:9999/version"
    # use curl_cffi
    resp = request.get(url, params={"start": 0}, data={"s": "dsds"}, timeout=5)
    resp = request.get(url, params={"start": 0}, json={"s": "dsds"}, timeout=5)
    # use requests
    resp = requests.get(url, params={"start": 0}, data={"s": "dsds"}, timeout=5)
    resp = requests.get(url, params={"start": 0}, json={"s": "dsds"}, timeout=5)

Versions

Additional context The server is a simple server written using golang's gin. In addition to that, get requests sent to me locally using curl_cffi are not captured by fiddler, but requests sent to me locally by the requests library are captured by fiddler. Snipaste_2024-09-21_12-20-50 Snipaste_2024-09-21_12-22-57

RachelAlucard commented 2 months ago

I found that if I add a proxy to the curl_cffi request and set the value to the port that fiddler listens on, fiddler captures the curl_cffi request correctly. But why does the requests library not need to be configured with a proxy for fiddler to capture the request correctly?

perklet commented 2 months ago

This has been fixed in https://github.com/lexiforest/curl_cffi/commit/0cf03feef8395bea0444f318435551e1fa7e0cdf, please wait for the new release. As for the capturing issue, it's probably because of the interfaces.

lexiforest commented 2 months ago

Released in 0.7.2.