Changeset 37 in code


Ignore:
Timestamp:
Nov 24, 2016, 9:35:37 PM (9 years ago)
Author:
asciimoo
Message:

[enh] display response errors to users ++ code formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/morty.go

    r36 r37  
    214214                        }
    215215                }
    216                 log.Println("invalid request:", resp.StatusCode())
     216                error_message := fmt.Sprintf("invalid response: %d", resp.StatusCode())
     217                p.serveMainPage(ctx, resp.StatusCode(), errors.New(error_message))
    217218                return
    218219        }
     
    505506                contentUrl := content[urlIndex+4:]
    506507                // special case of <meta http-equiv="refresh" content="0; url='example.com/url.with.quote.outside'">
    507                 if len(contentUrl)>=2 && (contentUrl[0] == byte('\'') || contentUrl[0] == byte('"')) {
     508                if len(contentUrl) >= 2 && (contentUrl[0] == byte('\'') || contentUrl[0] == byte('"')) {
    508509                        if contentUrl[0] == contentUrl[len(contentUrl)-1] {
    509                                 contentUrl=contentUrl[1:len(contentUrl)-1]
     510                                contentUrl = contentUrl[1 : len(contentUrl)-1]
    510511                        }
    511512                }
Note: See TracChangeset for help on using the changeset viewer.