aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http/headers.py
diff options
context:
space:
mode:
Diffstat (limited to 'netlib/http/headers.py')
-rw-r--r--netlib/http/headers.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/netlib/http/headers.py b/netlib/http/headers.py
index 14888ea9..f052a53b 100644
--- a/netlib/http/headers.py
+++ b/netlib/http/headers.py
@@ -156,8 +156,10 @@ class Headers(multidict.MultiDict):
Returns:
The number of replacements made.
"""
- pattern = _always_bytes(pattern)
- repl = _always_bytes(repl)
+ if isinstance(pattern, six.text_type):
+ pattern = strutils.escaped_str_to_bytes(pattern)
+ if isinstance(repl, six.text_type):
+ repl = strutils.escaped_str_to_bytes(repl)
pattern = re.compile(pattern, flags)
replacements = 0