Page 1 of 1

webRequest w/requestBody causes problems with big text in multipart forms

Posted: Sun Nov 10, 2019 3:21 am
by opennota
When I send 1200000+ bytes of text in a multipart form, the request never ends if NoScript is enabled. Firefox 70.0.1.

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))
}
And the code to generate 1200000 bytes of text:

Code: Select all

package main

import (
	"io/ioutil"
	"strings"
)

func main() {
	s := strings.Repeat("a ", 600000)
	ioutil.WriteFile("120000_bytes.txt", []byte(s), 0600)
}

Re: NoScript 11.0.8 causes problems with sending big multipart forms

Posted: Mon Nov 11, 2019 3:02 pm
by Giorgio Maone
Thanks for your report.
It's not NoScript-specific, but a Firefox bug for which I've just submitted this ticket.