fix typo: wepb

master
DebuggerX 4 years ago
parent 7d0e8d6323
commit af2b6544c8

@ -26,7 +26,7 @@ func main() {
log.Fatal(err)
}
http.HandleFunc("/", wepb2jpgHandler)
http.HandleFunc("/", webp2jpgHandler)
err = http.ListenAndServe(":9999", nil)
if err != nil {
log.Fatal(err)
@ -59,7 +59,7 @@ func hitCache(md5Path string, writer http.ResponseWriter) bool {
return true
}
func wepb2jpg(path string, md5Path string, writer http.ResponseWriter) {
func webp2jpg(path string, md5Path string, writer http.ResponseWriter) {
startTime := time.Now().UnixNano()
resp, getErr := http.Get(path)
@ -96,7 +96,7 @@ func wepb2jpg(path string, md5Path string, writer http.ResponseWriter) {
fmt.Printf("编码耗时:%dms\n", (endTime-startTime)/1e6)
}
func wepb2jpgHandler(writer http.ResponseWriter, request *http.Request) {
func webp2jpgHandler(writer http.ResponseWriter, request *http.Request) {
if !(strings.HasPrefix(request.URL.RawQuery, "http") && strings.HasSuffix(request.URL.RawQuery, ".webp")) {
writer.WriteHeader(404)
return
@ -109,5 +109,5 @@ func wepb2jpgHandler(writer http.ResponseWriter, request *http.Request) {
return
}
wepb2jpg(request.URL.RawQuery, md5Path, writer)
webp2jpg(request.URL.RawQuery, md5Path, writer)
}

Loading…
Cancel
Save