net/http/fcgi: fix a shutdown race
net/http/fcgi: fix a shutdown race

If a handler didn't consume all its Request.Body, child.go was
closing the socket while the host was still writing to it,
causing the child to send a RST and the host (at least nginx)
to send an empty response body.

Now, we tell the host we're done with the request/response
first, and then close our input pipe after consuming a bit of
it. Consuming the body fixes the problem, and flushing to the
host first to tell it that we're done increases the chance
that the host cuts off further data to us, meaning we won't
have much to consume.

No new tests, because this package is lacking in tests.
Tested by hand with nginx.  See issue for testing details.

Fixes issue 4183

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7939045

apparentlymart/golang,gnanderson/go,gnanderson/go,tv42/old-go,apparentlymart/golang,dsriram/golang,dsriram/golang,apparentlymart/golang,tv42/old-go,gnanderson/go,gnanderson/go,apparentlymart/golang,dsriram/golang,tv42/old-go,pombredanne/go-deleteme,tv42/old-go,dsriram/golang,pombredanne/go-deleteme,tv42/old-go,tv42/old-go,pombredanne/go-deleteme,apparentlymart/golang,pombredanne/go-deleteme,gnanderson/go,apparentlymart/golang,dsriram/golang,pombredanne/go-deleteme,dsriram/golang,gnanderson/go,apparentlymart/golang,pombredanne/go-deleteme,pombredanne/go-deleteme,dsriram/golang,gnanderson/go,tv42/old-go