瀏覽代碼

Use CURLOPT_NOBODY when doing HEAD request.

Miku AuahDark 2 年之前
父節點
當前提交
d9afbc7cc3
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/generic/CurlClient.cpp

+ 3 - 0
src/generic/CurlClient.cpp

@@ -178,6 +178,9 @@ HTTPSClient::Reply CurlClient::request(const HTTPSClient::Request &req)
 			newHeaders["Content-Type"] = "application/x-www-form-urlencoded";
 	}
 
+	if (method == "HEAD")
+		curl.easy_setopt(handle, CURLOPT_NOBODY, 1L);
+
 	// Curl doesn't copy memory, keep the strings around
 	std::vector<std::string> lines;
 	for (auto &header : newHeaders)