Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyrit/prompt_target/http_target/http_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,11 @@ def parse_raw_http_request(self, http_request: str) -> tuple[dict[str, str], Req
body = ""

# Support both LF and CRLF raw HTTP requests (e.g. copied from Burp).
request_parts = re.split(r"\r?\n\r?\n", http_request.strip(), maxsplit=1)
normalized = http_request.strip().replace("\r\n", "\n")
request_parts = normalized.split("\n\n", 1)

# Parse out the header components
header_lines = request_parts[0].strip().splitlines()
header_lines = request_parts[0].strip().split("\n")
http_req_info_line = header_lines[0].split(" ") # get 1st line like POST /url_ending HTTP_VSN
header_lines = header_lines[1:] # rest of the raw request is the headers info

Expand Down
Loading