1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-18 08:26:38 +02:00

Fix panic in httpTransportClient.Recv (#2530)

* [fix] http transport can send when wait for recv

* [fix] http transport can send multiple message and recevie them. Do not block send and receive on stream mode

* [fix] http transport can close the connection when recv is in progress, add tests

* [fix] Read buff before reset it, when the connection is closed

Co-authored-by: Hunyadvári Péter <peter.hunyadvari@vcc.live>
This commit is contained in:
Ak-Army 2022-07-22 09:36:36 +02:00 committed by GitHub
parent ec6a47c894
commit 48ba9f91b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -159,13 +159,14 @@ func (h *httpTransportClient) Recv(m *Message) error {
return io.EOF
}
rsp, err := http.ReadResponse(h.buff, r)
h.Unlock()
if err != nil {
h.Unlock()
return err
}
defer rsp.Body.Close()
b, err := ioutil.ReadAll(rsp.Body)
h.Unlock()
if err != nil {
return err
}