This commit is contained in:
wighawag 2016-05-23 12:19:18 +00:00
commit ef90339c38
2 changed files with 521 additions and 0 deletions

510
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" "net/url"
"strings" "strings"
"github.com/ethereum/go-ethereum/embed"
"github.com/rs/cors" "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. // send the request to the given API provider and sends the response back to the caller.
func newJSONHTTPHandler(srv *Server) http.HandlerFunc { func newJSONHTTPHandler(srv *Server) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { 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 { if r.ContentLength > maxHTTPRequestContentLength {
http.Error(w, http.Error(w,
fmt.Sprintf("content length too large (%d>%d)", r.ContentLength, maxHTTPRequestContentLength), fmt.Sprintf("content length too large (%d>%d)", r.ContentLength, maxHTTPRequestContentLength),