diff --git a/morty.go b/morty.go index 71f53cc..ff97d78 100644 --- a/morty.go +++ b/morty.go @@ -213,7 +213,8 @@ func (p *Proxy) RequestHandler(ctx *fasthttp.RequestCtx) { } } } - log.Println("invalid request:", resp.StatusCode()) + error_message := fmt.Sprintf("invalid response: %d", resp.StatusCode()) + p.serveMainPage(ctx, resp.StatusCode(), errors.New(error_message)) return } @@ -504,9 +505,9 @@ func sanitizeMetaAttrs(rc *RequestConfig, out io.Writer, attrs [][][]byte) { if bytes.Equal(http_equiv, []byte("refresh")) && urlIndex != -1 { contentUrl := content[urlIndex+4:] // special case of - if len(contentUrl)>=2 && (contentUrl[0] == byte('\'') || contentUrl[0] == byte('"')) { + if len(contentUrl) >= 2 && (contentUrl[0] == byte('\'') || contentUrl[0] == byte('"')) { if contentUrl[0] == contentUrl[len(contentUrl)-1] { - contentUrl=contentUrl[1:len(contentUrl)-1] + contentUrl = contentUrl[1 : len(contentUrl)-1] } } // output proxify result