Skip to content

Comments

Safeguard#1057

Closed
Kriechi wants to merge 2 commits intomitmproxy:masterfrom
Kriechi:safeguard
Closed

Safeguard#1057
Kriechi wants to merge 2 commits intomitmproxy:masterfrom
Kriechi:safeguard

Conversation

@Kriechi
Copy link
Member

@Kriechi Kriechi commented Mar 27, 2016


if not flow.response:
self.establish_server_connection(flow)
if not flow.response and self.establish_server_connection(flow):
Copy link
Member

Choose a reason for hiding this comment

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

This looks wrong? Why do we do this here?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the http2 layer gets terminated (due to a closed connection), establish_server_connection would go into a weird state in the h2 protocol - so it is easier just to cancel the whole stack of layers, and begin a fresh connection.

Copy link
Member

Choose a reason for hiding this comment

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

Why don't we just raise a proper exception in establish_server_connection then?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can do that. Raising or returning False will have the same effect - it needs to be handled. Right now, nobody cares if it fails.
Do you prefer an exception in this case?

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.

On Shutdown: flow is None and crashes

2 participants