curb
curb copied to clipboard
Is CURLOPT_REQUEST_TARGET needed for Request-URI different than Host header?
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
@decal i think maybe. If you send me a patch I could take a look more
@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);
}