Skip to content

Commit 867b6c8

Browse files
committed
Configurable max body request size
1 parent 869b3e4 commit 867b6c8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package revel
22

33
import (
4-
"code.google.com/p/go.net/websocket"
54
"fmt"
65
"io"
76
"net"
87
"net/http"
98
"strconv"
109
"strings"
1110
"time"
11+
12+
"code.google.com/p/go.net/websocket"
1213
)
1314

1415
var (
@@ -21,6 +22,7 @@ var (
2122
// This method handles all requests. It dispatches to handleInternal after
2223
// handling / adapting websocket connections.
2324
func handle(w http.ResponseWriter, r *http.Request) {
25+
r.Body = http.MaxBytesReader(w, r.Body, int64(Config.IntDefault("http.maxRequestSize", 10000000)))
2426
upgrade := r.Header.Get("Upgrade")
2527
if upgrade == "websocket" || upgrade == "Websocket" {
2628
websocket.Handler(func(ws *websocket.Conn) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy