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

Is CURLOPT_REQUEST_TARGET needed for Request-URI different than Host header? #427

Open
decal opened this issue Aug 14, 2021 · 2 comments
Open

Comments

@decal
Copy link

decal commented Aug 14, 2021

I'm wondering if CURLOPT_REQUEST_TARGET would need to be added to curb in order to perform requests where the Request-URI is different than the HTTP request's Host header (see code block below.) Perhaps there is another way to do this with Curl::Easy that I am unaware of. Please advise!

GET http://localhost HTTP/1.1
Host: google.com

@taf2
Copy link
Owner

taf2 commented Feb 13, 2022

@decal i think maybe. If you send me a patch I could take a look more

@taf2
Copy link
Owner

taf2 commented Dec 27, 2022

@decal reading the libcurl docs on this it looks like it's for setting OPTIONS request headers see: https://curl.se/libcurl/c/CURLOPT_REQUEST_TARGET.html

curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/*");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "OPTIONS");
 
  /* issue an OPTIONS * request (no leading slash) */
  curl_easy_setopt(curl, CURLOPT_REQUEST_TARGET, "*");
 
  /* Perform the request */
  curl_easy_perform(curl);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants