Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the ErrNothingRead to be exposed. #827

Merged
merged 3 commits into from
Jun 5, 2020

Conversation

wangfakang
Copy link
Contributor

@wangfakang wangfakang commented Jun 4, 2020

hello @erikdubbelboer We used the ReadLimitBody API directly to read client data, and to avoid this issue we need to check the error type, as below

……
                err := request.ReadLimitBody(conn.br, defaultMaxRequestBodySize)
                if err != nil {
                        _, errNothingRead := err.(fasthttp.ErrNothingRead)
                        if err != io.EOF && !errNothingRead {
                                // write error response
                                conn.conn.Write(buffer.NewIoBufferBytes(strErrorResponse))

                                // close connection with flush
                                conn.conn.Close(api.FlushWrite, api.LocalClose)
                        }
                   ……
                }
……

So need to exposed the ErrNothingRead erroy type, thx.

header.go Outdated Show resolved Hide resolved
update annotation.

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
@wangfakang
Copy link
Contributor Author

wangfakang commented Jun 5, 2020

/cc @erikdubbelboer it has been done.

@erikdubbelboer erikdubbelboer merged commit ac51d59 into valyala:master Jun 5, 2020
@erikdubbelboer
Copy link
Collaborator

Thanks!

wangfakang added a commit to wangfakang/mosn that referenced this pull request Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants