title: In Golang, Is http.HandleFunc block?
body: <p>i'm write a httpserver in Golang , but i find the http.HandleFunc will be block when multi request from the web browser. how can i do make the server handle multi request in the same time ? thanks.</p>
  
  <p>my code is:</p>
  
  <pre><code>func DoQuery(w http.ResponseWriter, r *http.Request) {
      r.ParseForm()
      fmt.Printf("%d path %s\n", time.Now().Unix(), r.URL.Path)
      time.Sleep(10 * time.Second)
      fmt.Fprintf(w, "hello...")
      //why this function block when multi request ?
  }
  
  func main() {
      fmt.Printf("server start working...\n")
      http.HandleFunc("/query", DoQuery)
      s := &amp;http.Server{
          Addr:         ":9090",
          ReadTimeout:  30 * time.Second,
          WriteTimeout: 30 * time.Second,
          //MaxHeaderBytes: 1 &lt;&lt; 20,
      }
      log.Fatal(s.ListenAndServe())
      fmt.Printf("server stop...")
  }
  </code></pre>
  
  <p>I ran your code and everything worked as expected. I did two requests at the same time (curl localhost:9090/query) and they both finished 10 seconds later, together. Maybe the problem is elsewhere? Here's the command I used: time curl -s localhost:9090/query | echo $(curl -s localhost:9090/query) – tjameson </p>
  
  <p>thakns </p>
  
  <p>that's strange.
  when i request same url from chrome ,send two request not handle in the same time, but use cur test can handle in the same time. 
  but when i send two request use different url, it's can be handle in the same time.</p>
  
  <p>[root@localhost httpserver]# ./httpServer   </p>
  
  <p>server start working...</p>
  
  <p>1374301593 path /query?form=chrome</p>
  
  <p>1374301612 path /query?from=cur2</p>
  
  <p>1374301614 path /query?from=cur1</p>
  
  <p>1374301618 path /query?form=chrome</p>
  
  <p>1374301640 path /query?form=chrome2</p>
  
  <p>1374301643 path /query?form=chrome1</p>
  
  <p>*1374301715 path /query?form=chrome</p>
  
  <p>1374301725 path /query?form=chrome*</p>
  
  <p>**1374301761 path /query?form=chrome1</p>
  
  <p>1374301763 path /query?form=chrome2**</p>