Skip to content

Conversation

@cbaugus
Copy link
Owner

@cbaugus cbaugus commented Jul 24, 2025

… to handle escaped commas (,) in header values

  1. Created a new parsing function: parse_headers_with_escapes() that properly handles the escape sequences
  2. Added comprehensive tests: Created 7 test cases covering various scenarios including:
    - Simple headers without commas
    - Headers with escaped commas (like Keep-Alive)
    - Multiple escaped commas in a single value
    - Backslashes that aren't escape sequences
    - Edge cases with whitespace and trailing commas
  3. Updated documentation: Added clear examples in the README showing how to use the escape sequence feature

The solution allows users to include commas in header values by escaping them with a backslash. For example:
-e CUSTOM_HEADERS="Connection:keep-alive,Keep-Alive:timeout=5\,max=200"

This will correctly parse as two headers:

  • Connection: keep-alive
  • Keep-Alive: timeout=5,max=200

…to handle escaped commas (\,) in header values

  2. Created a new parsing function: parse_headers_with_escapes() that properly handles the escape sequences
  3. Added comprehensive tests: Created 7 test cases covering various scenarios including:
    - Simple headers without commas
    - Headers with escaped commas (like Keep-Alive)
    - Multiple escaped commas in a single value
    - Backslashes that aren't escape sequences
    - Edge cases with whitespace and trailing commas
  4. Updated documentation: Added clear examples in the README showing how to use the escape sequence feature

  The solution allows users to include commas in header values by escaping them with a backslash. For example:
  -e CUSTOM_HEADERS="Connection:keep-alive,Keep-Alive:timeout=5\\,max=200"

  This will correctly parse as two headers:
  - Connection: keep-alive
  - Keep-Alive: timeout=5,max=200
@cbaugus cbaugus merged commit fbcb625 into main Dec 16, 2025
1 check passed
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.

2 participants