A simple web server in Go which demonstrates the problem (run it, open localhost:1234, paste some text and press the button):
Code: Select all
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
fmt.Fprintln(w, `<!DOCTYPE html><html><head><meta charset=utf-8></head><body>
<form method="POST" enctype="multipart/form-data" action="/">
<textarea name="text"></textarea>
<button type="submit">Submit</button>
</form></body></html>`)
} else {
println("start of io.Copy")
io.Copy(os.Stdout, r.Body)
println("end of io.Copy")
os.Exit(0)
}
}
func main() {
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":1234", nil))
}
Code: Select all
package main
import (
"io/ioutil"
"strings"
)
func main() {
s := strings.Repeat("a ", 600000)
ioutil.WriteFile("120000_bytes.txt", []byte(s), 0600)
}