Skip to content

Instantly share code, notes, and snippets.

@darasion
Last active March 23, 2016 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darasion/30ea7cb5a90750ef9627 to your computer and use it in GitHub Desktop.
Save darasion/30ea7cb5a90750ef9627 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"time"
"log"
"net/http"
)
type MyHandler struct {}
func (*MyHandler)ServeHTTP(http.ResponseWriter, *http.Request) {
fmt.Println("aaaa")
}
func main() {
s := &http.Server{
Addr: ":8989",
Handler: &MyHandler{},
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
go func() {
for {
time.Sleep(time.Millisecond)
s.ReadTimeout = time.Second
}
}()
log.Fatal(s.ListenAndServe())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment