-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(http): preserve raw URL bytes via opt-in url_raw flag #1533
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
|
|
||
| import aiohttp | ||
| import uvloop | ||
| from yarl import URL | ||
|
|
||
| from nettacker.core.lib.base import BaseEngine | ||
| from nettacker.core.utils.common import ( | ||
|
|
@@ -34,6 +35,8 @@ async def perform_request_action(action, request_options): | |
|
|
||
|
|
||
| async def send_request(request_options, method): | ||
| if request_options.pop("url_raw", False): | ||
| request_options["url"] = URL(request_options["url"], encoded=True) | ||
| async with aiohttp.ClientSession() as session: | ||
|
Comment on lines
+38
to
40
|
||
| action = getattr(session, method, None) | ||
| response = await asyncio.gather( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
url_rawis true, this assignment mutates the samesub_stepdictionary thatHttpEngine.runlater passes toBaseEngine.process_conditions. That path serializes the event withjson.dumps—and successful events are also serialized insubmit_logs_to_db—butyarl.URLis not JSON-serializable, so raw requests end with aTypeErrorand cannot record a finding even when the Apache response matches. Convert the URL only in a copied request dictionary, or restore the string before processing, and cover the flag throughHttpEngine.run.AGENTS.md reference: AGENTS.md:L27-L31
Useful? React with 👍 / 👎.