[OpenWrt-Devel] [PATCH uclient 2/2] uclient-fetch: use HEAD method in spider mode

Sungbo Eo mans0n at gorani.run
Mon Jan 6 08:40:16 EST 2020


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 at gorani.run>
---
 uclient-fetch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/uclient-fetch.c b/uclient-fetch.c
index 3718197..db5faee 100644
--- a/uclient-fetch.c
+++ b/uclient-fetch.c
@@ -336,7 +336,7 @@ static int init_request(struct uclient *cl)
 
 	msg_connecting(cl);
 
-	rc = uclient_http_set_request_type(cl, post_data ? "POST" : "GET");
+	rc = uclient_http_set_request_type(cl, post_data ? "POST" : no_output ? "HEAD" : "GET");
 	if (rc)
 		return rc;
 
-- 
2.24.1

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list