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

Using embedded Proxy input_args breaks logging/stdout #1336

Open
klmunday opened this issue Jun 20, 2023 · 1 comment
Open

Using embedded Proxy input_args breaks logging/stdout #1336

klmunday opened this issue Jun 20, 2023 · 1 comment
Labels
Bug Bug report in proxy server Good First Issue Issues for new contributors to pick-up

Comments

@klmunday
Copy link

klmunday commented Jun 20, 2023

I am currently creating an application which embeds proxy.py with a custom plugin.
Due to requiring custom flags within the custom plugin I am having to use the workaround detailed in #871 in order for them to parse correctly.

I have noticed that since implementing this workaround that I am no longer getting any logs/stdout from the proxy.

Simplified version of my code below.

def run_proxy() -> None:    
    proxy_py_args = [
        "--plugin", "<my plugin>",
        "--disable-headers", "Via"
    ]
    with proxy.Proxy(
            port=9000,
            input_args=proxy_py_args
    ) as p:
        logging.info(f"starting proxy at {p.flags.hostname}:{p.flags.port}")
        print(p.flags)
        proxy.sleep_loop()

I do not see the message from logging.info in stdout. However, I do see the print. I have tried specifying a log-file which seems to parse correctly into p.flags but it does not get written to.

However, when I run the following I see the regular logging/stdout.

def run_proxy() -> None:
    with proxy.Proxy(
            port=9000,
            plugins=["<plugin name>"]
    ) as _:
        proxy.sleep_loop()

This however breaks the parsing of the custom plugins flags (as detailed in #871) so this is not a solution.

I have also tried using proxy.main instead, then specifying my args via command line but that has not worked.

@abhinavsingh
Copy link
Owner

@klmunday Thanks for reporting, this needs little investigation. I don't think we have enough test coverage for custom plugin "flags", so this may have gone rogue. Give me some time, will look into it and #871

@abhinavsingh abhinavsingh added Bug Bug report in proxy server Good First Issue Issues for new contributors to pick-up labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug report in proxy server Good First Issue Issues for new contributors to pick-up
Projects
None yet
Development

No branches or pull requests

2 participants