summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-05-31 00:38:03 +0700
committerShulhan <ms@kilabit.info>2025-05-31 00:38:03 +0700
commite332a3351ab1c82dc18b62e3c251447a7020a280 (patch)
tree467cbb6fa3d2e9df66d6ee658dcf200851e06c6b
parent2fc24393b508854bf0f44ff45f25b43d2ac7158a (diff)
downloadjarink-e332a3351ab1c82dc18b62e3c251447a7020a280.tar.xz
all: use HTTP method HEAD to check for image link
Using HEAD does not return the content of image, which consume less resources on both end.
-rw-r--r--worker.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/worker.go b/worker.go
index f2be07f..99bef6f 100644
--- a/worker.go
+++ b/worker.go
@@ -129,7 +129,11 @@ func (wrk *worker) scan(linkq linkQueue) {
httpResp *http.Response
err error
)
- httpResp, err = http.Get(linkq.url)
+ if linkq.kind == atom.Img {
+ httpResp, err = http.Head(linkq.url)
+ } else {
+ httpResp, err = http.Get(linkq.url)
+ }
if err != nil {
if linkq.parentUrl == nil {
wrk.errq <- err