diff options
| author | Shulhan <ms@kilabit.info> | 2025-05-31 00:38:03 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-05-31 00:38:03 +0700 |
| commit | e332a3351ab1c82dc18b62e3c251447a7020a280 (patch) | |
| tree | 467cbb6fa3d2e9df66d6ee658dcf200851e06c6b | |
| parent | 2fc24393b508854bf0f44ff45f25b43d2ac7158a (diff) | |
| download | jarink-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.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |
