add support for http client uploads

fixes #27
This commit is contained in:
Lucas Clemente
2016-05-13 13:01:45 +02:00
parent c0c7650431
commit d1272650c3
6 changed files with 59 additions and 48 deletions

View File

@@ -4,6 +4,7 @@ import (
"crypto/tls"
"crypto/x509"
"flag"
"fmt"
"io/ioutil"
"net/http"
@@ -36,6 +37,13 @@ func main() {
}
}
http.HandleFunc("/echo", func(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
fmt.Printf("error reading body while handling /echo: %s\n", err.Error())
}
w.Write(body)
})
http.Handle("/", http.FileServer(http.Dir(*www)))
server, err := h2quic.NewServer(tlsConfig)