mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
implement html authorization EIP
This commit is contained in:
parent
57ba1824ac
commit
ce09f5593d
2 changed files with 410 additions and 0 deletions
399
embed/authorization.go
Normal file
399
embed/authorization.go
Normal file
File diff suppressed because one or more lines are too long
11
rpc/http.go
11
rpc/http.go
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in a new issue