Skip to content

http: fixing upgrade response bug#10615

Merged
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
alyssawilk:upgrade
Apr 10, 2020
Merged

http: fixing upgrade response bug#10615
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
alyssawilk:upgrade

Conversation

@alyssawilk
Copy link
Contributor

@alyssawilk alyssawilk commented Apr 1, 2020

Fixing a bug where upgrade response headers triggered the upgrade path

Risk Level: low (fixing a bug, runtime guarded)
Testing: fixed unit tests
Docs Changes: n/a
Release Notes: yes
Fixes #10566

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@mattklein123
Copy link
Member

@alyssawilk I might be misunderstanding, but I don't think this fixes #10566. The issue in that ticket AFIUI is that the client codec is shifting into upgrade mode when it received the upgrade header in the response, even though it isn't in response to a valid upgrade request. I think we need to actually remember in the request path if it's a valid upgrade request (like we do for HEAD requests) and then not shift into upgrade mode in the response in that case?

@alyssawilk
Copy link
Contributor Author

Ah, I think there's 2 bugs. There's what the codec does pulling in data, and what it does when serializing it out. I was indeed fixing only one, making sure it was written out correctly, where we need to fix both. Better fix and integration test coming up!

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@asraa
Copy link
Contributor

asraa commented Apr 1, 2020

Clearing response upgrade headers here would also fix this too, right? #8797

@alyssawilk
Copy link
Contributor Author

This does clear them over in conn_manager_utility.cc
Did you mean clearing in the codec?

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Awesome thanks. Just 1 question and 1 small test comment.

/wait

if (pending_response_.has_value()) {
return pending_response_->encoder_.upgrade_request_;
}
return false;
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a test that hits this branch?

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk alyssawilk added waiting and removed waiting labels Apr 2, 2020
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Nice thanks, just small nit.

/wait

Comment on lines +24 to +27
* http filters: http filter extensions use the "envoy.filters.http" name space. A mapping
of extension names is available in the :ref:`deprecated <deprecated>` documentation.
* http: fixing a bug where the upgrade header was not cleared on responses to non-upgrade requests.
Can be reverted temporarily by setting runtime feature `envoy.reloadable_features.fix_upgrade_response` to false.
Copy link
Member

Choose a reason for hiding this comment

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

nit: alpha order issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing it forward: #10695 :-P

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@mattklein123
Copy link
Member

Sorry can you merge master and move to 1.15.0?

/wait

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Contributor Author

@lambdai for ?backport?

mattklein123
mattklein123 previously approved these changes Apr 8, 2020
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Nice!

1.15.0 (Pending)
================

* http: fixing a bug where the upgrade header was not cleared on responses to non-upgrade requests.
Copy link
Member

Choose a reason for hiding this comment

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

s/fixing/fixed (per your own request =P)?

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@mattklein123
Copy link
Member

LGTM. Can you merge master in the morning once CI is fixed so we can make sure this passes?

/wait

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@mattklein123
Copy link
Member

docs CI error looks legit :(

/wait

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@mattklein123 mattklein123 merged commit 12e2622 into envoyproxy:master Apr 10, 2020
@alyssawilk alyssawilk deleted the upgrade branch August 27, 2020 16:33
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.

Envoy produces invalid response when TLS http/1.1 cluster returns upgrade: h2 and transfer-encoding: chunked

3 participants