implement html authorization EIP

This commit is contained in:
wighawag 2016-05-10 06:04:59 +01:00
parent 57ba1824ac
commit ce09f5593d
2 changed files with 410 additions and 0 deletions

399
embed/authorization.go Normal file

File diff suppressed because one or more lines are too long

View file

@ -26,6 +26,8 @@ import (
"net/url"
"strings"
"github.com/ethereum/go-ethereum/embed"
"github.com/rs/cors"
)
@ -104,6 +106,15 @@ func (t *httpReadWriteNopCloser) Close() error {
// send the request to the given API provider and sends the response back to the caller.
func newJSONHTTPHandler(srv *Server) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/authorization.html"{
w.Header().Set("Content-Type", "text/html; charset=utf-8")
if _, err := w.Write([]byte(embed.AuthorizationHTML)); err != nil {
fmt.Fprintf(w, "%s", err)
}
return
}
if r.ContentLength > maxHTTPRequestContentLength {
http.Error(w,
fmt.Sprintf("content length too large (%d>%d)", r.ContentLength, maxHTTPRequestContentLength),