summaryrefslogtreecommitdiff
path: root/href.go
diff options
context:
space:
mode:
Diffstat (limited to 'href.go')
-rw-r--r--href.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/href.go b/href.go
index d06ea40..c68499c 100644
--- a/href.go
+++ b/href.go
@@ -3,6 +3,7 @@ package main
import (
"net/http"
"strings"
+ "errors"
"golang.org/x/net/html"
)
@@ -28,6 +29,9 @@ func FetchTitle(url string) (string, error) {
return "", err
}
defer resp.Body.Close()
+ if resp.ContentLength > 8*1024*1024 {
+ return "", errors.New("content too big")
+ }
doc, err := html.Parse(resp.Body)
if err != nil {