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

rework deproxy server #572

Merged
merged 6 commits into from
Feb 9, 2024
Merged

rework deproxy server #572

merged 6 commits into from
Feb 9, 2024

Conversation

RomanBelozerov
Copy link
Contributor

No description provided.

Copy link
Contributor

@mbabitski-t mbabitski-t left a comment

Choose a reason for hiding this comment

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

It's better to use single underscore _ for internal variables, double underscore __ is intended to avoid conflicts in subclasses.

# This parameter controls whether to keep original data with the request
# (See deproxy.HttpMessage.original_data)
self.keep_original_data = kwargs.pop("keep_original_data", None)
class StaticDeproxyServer(asyncore.dispatcher, stateful.Stateful, port_checks.FreePortsChecker):
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Maybe we should create a base class from scratch, rather than use an async one, because we almost never use async in tests.

  2. asyncore.dispatcher is deprecated in favor of asyncio.Protocol

    Deprecated since version 3.6, will be removed in version 3.12: The asyncore module is deprecated (see PEP 594 for details). Please use asyncio instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think it is a good idea. I created #573 issue about this.

… The class Server `helpers/deproxy.py` should be removed after changing old tests.

The `BaseDeproxyServer` and `StaticDeproxyServer` were merged because inheritance makes it harder to work here. We have base class `asyncore.dispatcher`.
…es used in tests are available via `property`.
…t style. All variables with `__` changed to `_` because the main idea for this - restrict external access, but python does not restrict access anyway.
@RomanBelozerov RomanBelozerov force-pushed the rb-56-rework-deproxy-server branch from 5e953be to 2fe124d Compare February 7, 2024 11:28
… `ServerConnection.handle_close`. This method is called when FIN or RST is received from Tempesta.
Copy link
Contributor

@ykargin ykargin left a comment

Choose a reason for hiding this comment

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

Ok

@RomanBelozerov RomanBelozerov merged commit 98cb594 into master Feb 9, 2024
1 check failed
@RomanBelozerov RomanBelozerov deleted the rb-56-rework-deproxy-server branch February 9, 2024 08:29
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.

4 participants