package main import ( "fmt" "net/http" ) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", "sublime_text.tar.bz2")) w.Header().Add("Content-Type", "application/octet-stream") http.ServeFile(w, r, "/home/steven/sublime_text.tar.bz2") }) err := http.ListenAndServe(":8090", nil) if err != nil { fmt.Println(err) } }
func QueryUnescape func QueryUnescape (s string ) ( string , error ) QueryUnescape does the inverse transformation of QueryEscape, converting %AB into the byte 0xAB and '+' into ' ' (space). It returns an error if any % is not followed by two hexadecimal digits. func QueryUnescape func QueryUnescape (s string ) ( string , error ) QueryUnescape does the inverse transformation of QueryEscape, converting %AB into the byte 0xAB and '+' into ' ' (space). It returns an error if any % is not followed by two hexadecimal digits.
评论
发表评论