]> 127.0.0.1 Git - part/.git/commitdiff
fix v0.5.9
authorqydysky <qydysky@foxmail.com>
Mon, 12 Apr 2021 20:13:11 +0000 (04:13 +0800)
committerqydysky <qydysky@foxmail.com>
Mon, 12 Apr 2021 20:13:11 +0000 (04:13 +0800)
web/Web.go

index 5accba554abbbc98dff29e6f873ea3c7f346ae41..fcdfbba13785b7c11d9879471c54fb524931db74 100644 (file)
@@ -19,8 +19,6 @@ func New(conf *http.Server) (o *Web) {
 
        o.Server = conf
        
-       if o.Server.Addr == `` {o.Server.Addr = "127.0.0.1:"+strconv.Itoa(p.Sys().GetFreePort())}
-       if o.Server.WriteTimeout == 0 {o.Server.WriteTimeout =  time.Second * time.Duration(10)}
        if o.Server.Handler == nil {
                o.mux = http.NewServeMux()
                o.Server.Handler = o.mux
@@ -38,7 +36,10 @@ func (t *Web) Handle(path_func map[string]func(http.ResponseWriter,*http.Request
 }
 
 func Easy_boot() (*Web) {
-       s := New(&http.Server{})
+       s := New(&http.Server{
+               Addr: "127.0.0.1:"+strconv.Itoa(p.Sys().GetFreePort()),
+               WriteTimeout:  time.Second * time.Duration(10),
+       })
        s.Handle(map[string]func(http.ResponseWriter,*http.Request){
                `/`:func(w http.ResponseWriter,r *http.Request){
                        var path string = r.URL.Path[1:]