mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
Merge e928f269fe into 7f515b0e88
This commit is contained in:
commit
ef90339c38
2 changed files with 521 additions and 0 deletions
510
embed/authorization.go
Normal file
510
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"
|
"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),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue