diff mbox series

[uclient,2/2] uclient-fetch: use HEAD method in spider mode

Message ID 20200703014238.19281-2-mans0n@gorani.run
State Under Review
Delegated to: Sungbo Eo
Headers show
Series [uclient,1/2] uclient-fetch: fetch only header in spider mode | expand

Commit Message

Sungbo Eo July 3, 2020, 1:42 a.m. UTC
HEAD method does not request response body, so it is suitable for spider
mode. This also matches wget's behavior.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
---
v2: rebased
---
 uclient-fetch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/uclient-fetch.c b/uclient-fetch.c
index 95334b0..2d201ef 100644
--- a/uclient-fetch.c
+++ b/uclient-fetch.c
@@ -337,7 +337,7 @@  static int init_request(struct uclient *cl)
 
 	msg_connecting(cl);
 
-	rc = uclient_http_set_request_type(cl, post_data || post_file ? "POST" : "GET");
+	rc = uclient_http_set_request_type(cl, post_data || post_file ? "POST" : no_output ? "HEAD" : "GET");
 	if (rc)
 		return rc;