lexiforest / curl_cffi

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

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

Open RachelAlucard opened 2 hours ago

RachelAlucard commented 2 hours 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 hours 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?