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

optimize: adjust the behavior of PeekAll based on VisitAll #1403

Merged
merged 1 commit into from Oct 22, 2022

Conversation

li-jin-gou
Copy link
Contributor

@li-jin-gou li-jin-gou commented Oct 21, 2022

refer to #1394 (comment)

@@ -1827,7 +1833,6 @@ func (h *RequestHeader) peekAll(key []byte) [][]byte {
case HeaderCookie:
if h.cookiesCollected {
h.mulHeader = append(h.mulHeader, appendRequestCookieBytes(nil, h.cookies))
return [][]byte{appendRequestCookieBytes(nil, h.cookies)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for a problem here that I didn't find before.

@@ -1853,11 +1858,17 @@ func (h *ResponseHeader) peekAll(key []byte) [][]byte {
h.mulHeader = h.mulHeader[:0]
switch string(key) {
case HeaderContentType:
h.mulHeader = append(h.mulHeader, h.ContentType())
if contentType := h.ContentType(); len(contentType) > 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referring to VisitAll, I found that when using PeekAll, if the field is empty, he returns [][]byte{ '' } instead of [][]byte{} to the point that I modified it.

@erikdubbelboer erikdubbelboer merged commit 128e9b3 into valyala:master Oct 22, 2022
14 checks passed
@erikdubbelboer
Copy link
Collaborator

Thanks!

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.

None yet

2 participants