Comments (3)
This is probably entirely the wrong way to fix it, but it works for me...
diff --git a/libmproxy/utils.py b/libmproxy/utils.py
index 8ac1f54..d22334d 100644
--- a/libmproxy/utils.py
+++ b/libmproxy/utils.py
@@ -190,14 +190,17 @@ class MultiDict:
_helper = (str,)
def __init__(self):
self._d = dict()
+ self._d2 = dict()
def copy(self):
m = self.__class__()
m._d = self._d.copy()
+ m._d2 = self._d2.copy()
return m
def clear(self):
- return self._d.clear()
+ self._d2.clear()
+ return self._d_clear()
def get(self, key, d=None):
key = self._helper[0](key)
@@ -212,6 +215,7 @@ class MultiDict:
def __delitem__(self, key):
self._d.__delitem__(key)
+ self._d2.__delitem__(key)
def __getitem__(self, key):
key = self._helper[0](key)
@@ -220,8 +224,9 @@ class MultiDict:
def __setitem__(self, key, value):
if not isSequenceLike(value):
raise ValueError, "Cannot insert non-sequence."
- key = self._helper[0](key)
- return self._d.__setitem__(key, value)
+ hkey = self._helper[0](key)
+ self._d2.__setitem__(hkey, key)
+ return self._d.__setitem__(hkey, value)
def has_key(self, key):
key = self._helper[0](key)
@@ -240,6 +245,7 @@ class MultiDict:
self[key].extend(value)
def append(self, key, value):
+ key = self._helper[0](key)
self.extend(key, [value])
def itemPairs(self):
@@ -276,7 +282,7 @@ class Headers(MultiDict):
headerElements = []
for key in sorted(self.keys()):
for val in self[key]:
- headerElements.append(key + ": " + val)
+ headerElements.append(self._d2[key] + ": " + val)
headerElements.append("")
return "\r\n".join(headerElements)
from mitmproxy.
Hi,
This has been on my list of things to fix for a while. I've just committed a rewrite of the Headers class that abandons the pretence that we're dealing with a multi-keyed dict. Instead, we store headers as an ordered list of tuples, with dict-like operations working on the list itself. This means that both header order and case is now preserved.
Please take a look and let me know if this works for you.
Cheers,
Aldo
from mitmproxy.
Yes, that works fine now; thanks.
from mitmproxy.
Related Issues (20)
- mitmproxy don't work with bore tunnel and own DNS server HOT 1
- Reading file from stdin does not work HOT 3
- `mitmproxy --scripts broken.py` with a broken script does not properly handle the error and leaves terminal in a funny state HOT 1
- Render `flow.comment` in mitmweb as column and also in the sidebar HOT 4
- When executing mitmdump --version in cmd, the following error message appears: HOT 1
- export websocket messages HOT 1
- The mitmproxy program failed to start because the default port 8080 was occupied. HOT 2
- Fresh installed mitmproxy 10.2.3 gives a warning from cryptography 42.0.x on startup HOT 1
- export websocket messages HOT 10
- search websocket messages HOT 4
- test_load_script is language dependent HOT 1
- Content Missing when getting a large file(>1mb) HOT 1
- Cannot resize panels on Safari HOT 2
- Expired Credentials (mitmproxy-ca-cert.pem) HOT 2
- Failed to proxy HTTPS request to unicode domains
- Getting deprecation warning HOT 5
- Running mitmproxy's reverse-proxy mode locally HOT 3
- Nuke `dns_spoofing.py` addon and fix docs
- Add `dns_server` option. HOT 3
- Internet not working without mitmproxy enabled
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mitmproxy.