)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"bb88d58d253a86a42021ef62e6718c9795769f4f","unresolved":false,"context_lines":[{"line_number":16,"context_line":"parse_mime_headers utility takes inspiration. (The parse_mime_headers"},{"line_number":17,"context_line":"implementation in this commit won\u0027t actually work with Python 3, whose"},{"line_number":18,"context_line":"email.parser.Parser().parsestr expects a Unicode string, but it is"},{"line_number":19,"context_line":"believed that this could be addressed in followup work.)"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Change-Id: Ia5ee2ead67e36e8c6416183667f64ae255887736"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"9a1a9d01_2be53fa7","line":19,"updated":"2015-10-03 16:26:29.000000000","message":"Yeah, it\u0027s ok to add Python 3 support later. Right now, we are too far from supporting Python 3 in Swift anyway.\n\nYou may mention a small API change: the object created by the new function only supports .get(header_name), .getheader(header_name) is no more supported.","commit_id":"926643b8ce24e96af64958c914c10eee1eab5d88"},{"author":{"_account_id":9878,"name":"Zack M. Davis","email":"zdavis@swiftstack.com","username":"zackmdavis"},"change_message_id":"eda54ec162fd1bcf8efc230a9165d31e99159293","unresolved":false,"context_lines":[{"line_number":16,"context_line":"parse_mime_headers utility takes inspiration. (The parse_mime_headers"},{"line_number":17,"context_line":"implementation in this commit won\u0027t actually work with Python 3, whose"},{"line_number":18,"context_line":"email.parser.Parser().parsestr expects a Unicode string, but it is"},{"line_number":19,"context_line":"believed that this could be addressed in followup work.)"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Change-Id: Ia5ee2ead67e36e8c6416183667f64ae255887736"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"7a2fa921_f113ff0b","line":19,"in_reply_to":"9a1a9d01_2be53fa7","updated":"2015-10-05 19:35:09.000000000","message":"Done","commit_id":"926643b8ce24e96af64958c914c10eee1eab5d88"}],"swift/common/utils.py":[{"author":{"_account_id":6968,"name":"Christian Schwede","email":"cschwede@nvidia.com","username":"cschwede"},"change_message_id":"2f8d1941d1a928f6151f8272e8ccfb95624417c9","unresolved":false,"context_lines":[{"line_number":3431,"context_line":"        headers[current_header] \u003d current_value"},{"line_number":3432,"context_line":""},{"line_number":3433,"context_line":"    return headers"},{"line_number":3434,"context_line":""},{"line_number":3435,"context_line":""},{"line_number":3436,"context_line":"def mime_to_document_iters(input_file, boundary, read_chunk_size\u003d4096):"},{"line_number":3437,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"3a50d1a3_64cfb029","line":3434,"updated":"2015-07-22 07:29:11.000000000","message":"So, here is another idea - what about using email.message_from_file? For example:\n\n import email\n msg \u003d email.message_from_file(doc_file)\n headers \u003d dict(msg.items())\n\nMight be easier?","commit_id":"5381d2ece94e73788cf4ad42084c54dcfedfbe7b"},{"author":{"_account_id":9878,"name":"Zack M. Davis","email":"zdavis@swiftstack.com","username":"zackmdavis"},"change_message_id":"ef0f41b59d555edf16d9ec377f0ba8b8afc6284d","unresolved":false,"context_lines":[{"line_number":3431,"context_line":"        headers[current_header] \u003d current_value"},{"line_number":3432,"context_line":""},{"line_number":3433,"context_line":"    return headers"},{"line_number":3434,"context_line":""},{"line_number":3435,"context_line":""},{"line_number":3436,"context_line":"def mime_to_document_iters(input_file, boundary, read_chunk_size\u003d4096):"},{"line_number":3437,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"3a50d1a3_3660daa4","line":3434,"in_reply_to":"3a50d1a3_64cfb029","updated":"2015-07-22 17:05:15.000000000","message":"The problem with `email.message_from_file` is that it consumes the body of `doc_file`, whereas callers expect `doc_file` to have been read to the end of the headers and the file pointer left exactly there, so it can\u0027t be a drop-in replacement for the way we\u0027ve been using `rfc822.Message`. (E.g., replacing lines 3418 through 3431 of this patchset with the three lines from your comment results in 61 failing unit tests.) \n\nOf course, we could rewrite the callers to expect something else, but I fear that might be even more painful.","commit_id":"5381d2ece94e73788cf4ad42084c54dcfedfbe7b"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"c25e5a015861476ef303da40c5c6ebf77980da13","unresolved":false,"context_lines":[{"line_number":37,"context_line":"except ImportError:  # Python 2"},{"line_number":38,"context_line":"    import rfc822"},{"line_number":39,"context_line":"    def parse_headers(doc_file):"},{"line_number":40,"context_line":"        return rfc822.Message(doc_file, 0)"},{"line_number":41,"context_line":"from random import random, shuffle"},{"line_number":42,"context_line":"from urllib import quote as _quote"},{"line_number":43,"context_line":"from contextlib import contextmanager, closing"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba15a1d1_a319658a","line":40,"updated":"2015-09-15 20:00:01.000000000","message":"Since the code is not too long (12 lines of code + docstring), I suggest to add a copy the Python 3 parse_headers() in Swift for Python 2. The \"copy\" should probably adapted to handle unicode versus bytes as Swift expects (I didn\u0027t check what is the preferred input and output types in Swift on Python 2).\n\nCode in Python 3.6 (default Mercurial branch):\n\nhttps://hg.python.org/cpython/file/tip/Lib/http/client.py#l179\n\nNote: _MAXHEADERS can be read from httplib._MAXHEADERS on Python 2.","commit_id":"b1d11dd74b871c88a39be5265e267cb65261f6a7"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"5832053fad42f3bd63bea918d0d29cbea65aea6c","unresolved":false,"context_lines":[{"line_number":3394,"context_line":"    This function has been adapted from the Python standard library\u0027s"},{"line_number":3395,"context_line":"    http.client.parse_headers."},{"line_number":3396,"context_line":""},{"line_number":3397,"context_line":"    :param doc_file: file-like object containing a MIME document"},{"line_number":3398,"context_line":"    :returns: a swift.common.swob.HeaderKeyDict containing the headers"},{"line_number":3399,"context_line":"    \"\"\""},{"line_number":3400,"context_line":"    from swift.common.swob import HeaderKeyDict  # avoid circular import"}],"source_content_type":"text/x-python","patch_set":6,"id":"ba15a1d1_0b9378a4","line":3397,"updated":"2015-09-16 07:50:59.000000000","message":"You may mention that the function expects a binary file(-like), not a text file. readline() must return byte strings, not Unicode strings.","commit_id":"8d0938581e1c5e3fa515815fcc44c98d10e1322c"},{"author":{"_account_id":9878,"name":"Zack M. Davis","email":"zdavis@swiftstack.com","username":"zackmdavis"},"change_message_id":"354dd3abeba15b91652c638f15ac673f8c83cac0","unresolved":false,"context_lines":[{"line_number":3394,"context_line":"    This function has been adapted from the Python standard library\u0027s"},{"line_number":3395,"context_line":"    http.client.parse_headers."},{"line_number":3396,"context_line":""},{"line_number":3397,"context_line":"    :param doc_file: file-like object containing a MIME document"},{"line_number":3398,"context_line":"    :returns: a swift.common.swob.HeaderKeyDict containing the headers"},{"line_number":3399,"context_line":"    \"\"\""},{"line_number":3400,"context_line":"    from swift.common.swob import HeaderKeyDict  # avoid circular import"}],"source_content_type":"text/x-python","patch_set":6,"id":"ba15a1d1_6bb45081","line":3397,"in_reply_to":"ba15a1d1_0b9378a4","updated":"2015-09-16 22:27:36.000000000","message":"Done","commit_id":"8d0938581e1c5e3fa515815fcc44c98d10e1322c"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"21977e27837b3aa8eee46f3397189d675b453591","unresolved":false,"context_lines":[{"line_number":3404,"context_line":"        headers.append(line)"},{"line_number":3405,"context_line":"        if line in (b\u0027\\r\\n\u0027, b\u0027\\n\u0027, b\u0027\u0027):"},{"line_number":3406,"context_line":"            break"},{"line_number":3407,"context_line":"    header_string \u003d b\u0027\u0027.join(headers).decode(\u0027ascii\u0027)"},{"line_number":3408,"context_line":"    return HeaderKeyDict(email.parser.Parser().parsestr(header_string))"},{"line_number":3409,"context_line":""},{"line_number":3410,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"ba15a1d1_47c6ff68","line":3407,"updated":"2015-09-17 13:33:55.000000000","message":"I suggest to drop the .decode(\u0027ascii\u0027) part of this line: I checked, tests still pass on Python 2.\n\nI tried hard to run Swift unit tests on Python 3 to check if this function works on Python 3. I\u0027m sorry, it\u0027s quite impossible to run Swift tests right now on Python 3. Too many changes are required.\n\nSee my pending Python 3 patches (ignore the work-in-progress changes, I will rebase them later):\nhttps://review.openstack.org/#/q/status:open+project:openstack/swift+branch:master+topic:py3+owner:%22Victor+Stinner%22,n,z\n\nI suggest to rework this function to fix bytes versus Unicode issues when Swift will  be testable by Python 3.","commit_id":"8d4d3182a2d669ace6721e5d0925ebc6d9b95bdb"},{"author":{"_account_id":9878,"name":"Zack M. Davis","email":"zdavis@swiftstack.com","username":"zackmdavis"},"change_message_id":"53c94e4e51016c4a8340cdf6787ee942af04226a","unresolved":false,"context_lines":[{"line_number":3404,"context_line":"        headers.append(line)"},{"line_number":3405,"context_line":"        if line in (b\u0027\\r\\n\u0027, b\u0027\\n\u0027, b\u0027\u0027):"},{"line_number":3406,"context_line":"            break"},{"line_number":3407,"context_line":"    header_string \u003d b\u0027\u0027.join(headers).decode(\u0027ascii\u0027)"},{"line_number":3408,"context_line":"    return HeaderKeyDict(email.parser.Parser().parsestr(header_string))"},{"line_number":3409,"context_line":""},{"line_number":3410,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"ba15a1d1_74a12f93","line":3407,"in_reply_to":"ba15a1d1_47c6ff68","updated":"2015-09-18 18:33:56.000000000","message":"\u003e I suggest to drop the .decode(\u0027ascii\u0027) part of this line [...] I suggest to rework this function to fix bytes versus Unicode issues when Swift will be testable by Python 3.\n\nBut note that we don\u0027t need the rest of the Swift tests to know that Python 3\u0027s email.parser.Parser.parsestr will expect a Unicode string---\n\nIn [15]: sys.version_info\n\nOut[15]: sys.version_info(major\u003d3, minor\u003d4, micro\u003d0, releaselevel\u003d\u0027final\u0027, serial\u003d0)\n\nIn [16]: header_bytes\n\nOut[16]: b\u0027Content-Disposition: form-data; name\u003d\"file_size\"\\nFoo: Bar\\nNOT-title-cAsED: quux\\n\\n\u0027\n\nIn [17]: email.parser.Parser().parsestr(header_bytes).items()\n\n---------------------------------------------------------------------------\n\nTypeError                                 Traceback (most recent call last)\n\u003cipython-input-17-3ab8a03e9d8c\u003e in \u003cmodule\u003e()\n----\u003e 1 email.parser.Parser().parsestr(header_bytes).items()\n\n/usr/lib/python3.4/email/parser.py in parsestr(self, text, headersonly)\n     66         the file.\n     67         \"\"\"\n---\u003e 68         return self.parse(StringIO(text), headersonly\u003dheadersonly)\n     69 \n     70 \n\nTypeError: initial_value must be str or None, not bytes\n\nIn [18]: email.parser.Parser().parsestr(header_bytes.decode(\u0027ascii\u0027)).items()\nOut[18]: \n[(\u0027Content-Disposition\u0027, \u0027form-data; name\u003d\"file_size\"\u0027),\n (\u0027Foo\u0027, \u0027Bar\u0027),\n (\u0027NOT-title-cAsED\u0027, \u0027quux\u0027)]","commit_id":"8d4d3182a2d669ace6721e5d0925ebc6d9b95bdb"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"59efc4c532a3d01b03e175c07815a8695f8b9fc9","unresolved":false,"context_lines":[{"line_number":3404,"context_line":"        headers.append(line)"},{"line_number":3405,"context_line":"        if line in (b\u0027\\r\\n\u0027, b\u0027\\n\u0027, b\u0027\u0027):"},{"line_number":3406,"context_line":"            break"},{"line_number":3407,"context_line":"    header_string \u003d b\u0027\u0027.join(headers).decode(\u0027ascii\u0027)"},{"line_number":3408,"context_line":"    return HeaderKeyDict(email.parser.Parser().parsestr(header_string))"},{"line_number":3409,"context_line":""},{"line_number":3410,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"ba15a1d1_65307f9f","line":3407,"in_reply_to":"ba15a1d1_74a12f93","updated":"2015-09-21 07:45:29.000000000","message":"On Python 3, there is a parser for bytes strings.\n\nI don\u0027t understand why you decode the line from ASCII whereas the Python 3 code decodes from ISO-8859-1 (latin1), as specified in the HTTP RFC.","commit_id":"8d4d3182a2d669ace6721e5d0925ebc6d9b95bdb"}],"test/unit/common/test_utils.py":[{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"5832053fad42f3bd63bea918d0d29cbea65aea6c","unresolved":false,"context_lines":[{"line_number":4825,"context_line":""},{"line_number":4826,"context_line":"    def test_read_doc_file(self):"},{"line_number":4827,"context_line":"        doc_file \u003d BytesIO(b\"\"\"Content-Disposition: form-data; name\u003d\"file_size\""},{"line_number":4828,"context_line":"Foo: Bar"},{"line_number":4829,"context_line":""},{"line_number":4830,"context_line":"This is the body"},{"line_number":4831,"context_line":"\"\"\")"}],"source_content_type":"text/x-python","patch_set":6,"id":"ba15a1d1_8b6228ac","line":4828,"updated":"2015-09-16 07:50:59.000000000","message":"You should also test that encoding of header values. Add for example the header \"Unicode: h\\xe9llo\".","commit_id":"8d0938581e1c5e3fa515815fcc44c98d10e1322c"},{"author":{"_account_id":9878,"name":"Zack M. Davis","email":"zdavis@swiftstack.com","username":"zackmdavis"},"change_message_id":"354dd3abeba15b91652c638f15ac673f8c83cac0","unresolved":false,"context_lines":[{"line_number":4825,"context_line":""},{"line_number":4826,"context_line":"    def test_read_doc_file(self):"},{"line_number":4827,"context_line":"        doc_file \u003d BytesIO(b\"\"\"Content-Disposition: form-data; name\u003d\"file_size\""},{"line_number":4828,"context_line":"Foo: Bar"},{"line_number":4829,"context_line":""},{"line_number":4830,"context_line":"This is the body"},{"line_number":4831,"context_line":"\"\"\")"}],"source_content_type":"text/x-python","patch_set":6,"id":"ba15a1d1_46206148","line":4828,"in_reply_to":"ba15a1d1_8b6228ac","updated":"2015-09-16 22:27:36.000000000","message":"Ah, thank you, this is an important subtlety. The `.decode(\u0027iso-8859-1\u0027)` call in `parse_mime_headers` was just imitating `http.client.parse_headers`, but it would fail on Python 2 (where the StringIO used by email.parser.Parser.parsestr is more like what Python-3-istas would call BytesIO):\n\n\u003e\u003e\u003e headers\n[\u0027Content-Disposition: form-data; name\u003d\"file_size\"\\n\u0027, \u0027Foo: Bar\\n\u0027, \u0027NOT-title-cAsED: quux\\n\u0027, \u0027Hello: w\\xf6rld\\n\u0027, \u0027\\n\u0027]\n\u003e\u003e\u003e headers_string \u003d b\u0027\u0027.join(headers).decode(\u0027iso-8859-1\u0027)\n\u003e\u003e\u003e headers_string\nu\u0027Content-Disposition: form-data; name\u003d\"file_size\"\\nFoo: Bar\\nNOT-title-cAsED: quux\\nHello: w\\xf6rld\\n\\n\u0027\n\u003e\u003e\u003e email.parser.Parser().parsestr(headers_string)\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n  File \"/usr/lib/python2.7/email/parser.py\", line 82, in parsestr\n    return self.parse(StringIO(text), headersonly\u003dheadersonly)\nUnicodeEncodeError: \u0027ascii\u0027 codec can\u0027t encode character u\u0027\\xf6\u0027 in position 88: ordinal not in range(128)\n\nI\u0027m not entirely sure what Swift expects or should expect about header encodings. It looks like RFC 2822 says that headers should be ASCII (https://tools.ietf.org/html/rfc2822#section-2.1), so maybe `parse_mime_headers` can actually assume we\u0027re dealing with ASCII headers in our input, and return a HeaderKeyDict whose keys and values are whatever \u0027str\u0027 is on the relevant Python version? I eagerly welcome corrections from someone who knows more about what the rest of Swift assumes (or should assume).","commit_id":"8d0938581e1c5e3fa515815fcc44c98d10e1322c"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"5832053fad42f3bd63bea918d0d29cbea65aea6c","unresolved":false,"context_lines":[{"line_number":4834,"context_line":"        expected \u003d [(b\u0027Content-Disposition\u0027, b\u0027form-data; name\u003d\"file_size\"\u0027),"},{"line_number":4835,"context_line":"                    (b\u0027Foo\u0027, b\"Bar\")]"},{"line_number":4836,"context_line":"        for expected_header, expected_value in expected:"},{"line_number":4837,"context_line":"            self.assertEqual(expected_value, headers[expected_header])"},{"line_number":4838,"context_line":""},{"line_number":4839,"context_line":"        self.assertEqual(b\"This is the body\\n\", doc_file.read())"},{"line_number":4840,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"ba15a1d1_eb96444b","line":4837,"updated":"2015-09-16 07:50:59.000000000","message":"You can compare the whole dict instead:\n\nexpected_value \u003d {...}\nself.assertEqual(expected_value, header)","commit_id":"8d0938581e1c5e3fa515815fcc44c98d10e1322c"},{"author":{"_account_id":9878,"name":"Zack M. Davis","email":"zdavis@swiftstack.com","username":"zackmdavis"},"change_message_id":"354dd3abeba15b91652c638f15ac673f8c83cac0","unresolved":false,"context_lines":[{"line_number":4834,"context_line":"        expected \u003d [(b\u0027Content-Disposition\u0027, b\u0027form-data; name\u003d\"file_size\"\u0027),"},{"line_number":4835,"context_line":"                    (b\u0027Foo\u0027, b\"Bar\")]"},{"line_number":4836,"context_line":"        for expected_header, expected_value in expected:"},{"line_number":4837,"context_line":"            self.assertEqual(expected_value, headers[expected_header])"},{"line_number":4838,"context_line":""},{"line_number":4839,"context_line":"        self.assertEqual(b\"This is the body\\n\", doc_file.read())"},{"line_number":4840,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"ba15a1d1_8bb9a47b","line":4837,"in_reply_to":"ba15a1d1_eb96444b","updated":"2015-09-16 22:27:36.000000000","message":"Done","commit_id":"8d0938581e1c5e3fa515815fcc44c98d10e1322c"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"bb88d58d253a86a42021ef62e6718c9795769f4f","unresolved":false,"context_lines":[{"line_number":4932,"context_line":"    def test_parse_mime_headers(self):"},{"line_number":4933,"context_line":"        doc_file \u003d BytesIO(b\"\"\"Content-Disposition: form-data; name\u003d\"file_size\""},{"line_number":4934,"context_line":"Foo: Bar"},{"line_number":4935,"context_line":"NOT-title-cAsED: quux"},{"line_number":4936,"context_line":""},{"line_number":4937,"context_line":"This is the body"},{"line_number":4938,"context_line":"\"\"\")"}],"source_content_type":"text/x-python","patch_set":8,"id":"9a1a9d01_6bdb37ee","line":4935,"updated":"2015-10-03 16:26:29.000000000","message":"You may add an header with non-ASCII value:\n\nlatin1: \\xe9\nutf-8: b\u0027\\xc3\\xa9\u0027\n\nAnd then check that values are decoded as expected.\n\nSorry, I don\u0027t know if Swift is expected to decode HTTP headers from Latin1 or from UTF-8. What matters here is IMHO to keep backward compatibility.","commit_id":"926643b8ce24e96af64958c914c10eee1eab5d88"},{"author":{"_account_id":5600,"name":"Brian Cline","email":"bcline@softlayer.com","username":"briancline"},"change_message_id":"9c92c894e5841a22d5c79e91518b71c5c6de22ac","unresolved":false,"context_lines":[{"line_number":4932,"context_line":"    def test_parse_mime_headers(self):"},{"line_number":4933,"context_line":"        doc_file \u003d BytesIO(b\"\"\"Content-Disposition: form-data; name\u003d\"file_size\""},{"line_number":4934,"context_line":"Foo: Bar"},{"line_number":4935,"context_line":"NOT-title-cAsED: quux"},{"line_number":4936,"context_line":""},{"line_number":4937,"context_line":"This is the body"},{"line_number":4938,"context_line":"\"\"\")"}],"source_content_type":"text/x-python","patch_set":8,"id":"9a1a9d01_847c7073","line":4935,"in_reply_to":"9a1a9d01_6bdb37ee","updated":"2015-10-05 05:25:08.000000000","message":"+1, would be great to see more scenarios here. Maybe some of the encoding/decoding scenarios that the py3 email tests check for?\nhttps://hg.python.org/releasing/3.5/file/tip/Lib/test/test_email/test__header_value_parser.py\n\nThinking mostly about cases like:\n    \u0027\u003d?iso-8859-1?q?hello\u003d20world?\u003d\u0027\n    \u0027\u003d?utf-8?q?\u003dC3\u003d89ric?\u003d\u0027\n    \u0027\\xc5\\x9ew\\xe1\\xb8\\xae\\xf0\\x9d\\x91\\x93\\xe2\\x93\\x89\u0027\n    \u0027\\xe2\\x98\\x83\u0027\n\n(I tried including that third one as the actual unicode characters, and Gerrit 500\u0027d on me!)\n\nGranted, this parser\u0027s results will differ for some of the above scenarios, at least for now. Seems like it\u0027d help though to have them fleshed out to know the current behavior in a variety of cases -- especially before the later changes that will support py3, as well as later changes related to possibly matching RFC behavior (or not).","commit_id":"926643b8ce24e96af64958c914c10eee1eab5d88"},{"author":{"_account_id":9878,"name":"Zack M. Davis","email":"zdavis@swiftstack.com","username":"zackmdavis"},"change_message_id":"eda54ec162fd1bcf8efc230a9165d31e99159293","unresolved":false,"context_lines":[{"line_number":4932,"context_line":"    def test_parse_mime_headers(self):"},{"line_number":4933,"context_line":"        doc_file \u003d BytesIO(b\"\"\"Content-Disposition: form-data; name\u003d\"file_size\""},{"line_number":4934,"context_line":"Foo: Bar"},{"line_number":4935,"context_line":"NOT-title-cAsED: quux"},{"line_number":4936,"context_line":""},{"line_number":4937,"context_line":"This is the body"},{"line_number":4938,"context_line":"\"\"\")"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a2fa921_4720f1f7","line":4935,"in_reply_to":"9a1a9d01_847c7073","updated":"2015-10-05 19:35:09.000000000","message":"The most straightforwardly backward-compatible (if perhaps not the most ultimately desirable) thing to do is just use the bytestrings without any decoding---\n\n\u003e\u003e\u003e doc_file \u003d BytesIO(b\"\"\"Content-Disposition: form-data; name\u003d\"file_size\"\n\n... Foo: Bar\n\n... NOT-title-cAsED: quux\n\n... Connexion: \u003d?iso8859-1?q?r\u003dE9initialis\u003dE9e_par_l\u003d27homologue?\u003d\n\n... Status: \u003d?utf-8?b?5byA5aeL6YCa6L+H5a+56LGh5aSN5Yi2?\u003d\n\n... Latin-1: Resincronizaci\\xf3n realizada con \\xe9xito\n\n... Utf-8: \\xd0\\xba\\xd0\\xbe\\xd0\\xbd\\xd1\\x82\\xd0\\xb5\\xd0\\xb9\\xd0\\xbd\\xd0\\xb5\\xd1\\x80\n... \n\n... This is the body\n\n... \"\"\")\n\n\u003e\u003e\u003e h \u003d rfc822.Message(doc_file, 0)  # the old way\n\n\u003e\u003e\u003e dict(h)\n\n{\u0027status\u0027: \u0027\u003d?utf-8?b?5byA5aeL6YCa6L+H5a+56LGh5aSN5Yi2?\u003d\u0027, \u0027not-title-cased\u0027: \u0027quux\u0027, \u0027content-disposition\u0027: \u0027form-data; name\u003d\"file_size\"\u0027, \u0027latin-1\u0027: \u0027Resincronizaci\\xf3n realizada con \\xe9xito\u0027, \u0027utf-8\u0027: \u0027\\xd0\\xba\\xd0\\xbe\\xd0\\xbd\\xd1\\x82\\xd0\\xb5\\xd0\\xb9\\xd0\\xbd\\xd0\\xb5\\xd1\\x80\u0027, \u0027foo\u0027: \u0027Bar\u0027, \u0027connexion\u0027: \u0027\u003d?iso8859-1?q?r\u003dE9initialis\u003dE9e_par_l\u003d27homologue?\u003d\u0027}\n\nPatch set 9 adds these examples to the test (with a comment hinting that we may want to change how this works later).","commit_id":"926643b8ce24e96af64958c914c10eee1eab5d88"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"78df922ad1508c831a9e72b1919f187fae758b47","unresolved":false,"context_lines":[{"line_number":4933,"context_line":"        doc_file \u003d BytesIO(b\"\"\"Content-Disposition: form-data; name\u003d\"file_size\""},{"line_number":4934,"context_line":"Foo: Bar"},{"line_number":4935,"context_line":"NOT-title-cAsED: quux"},{"line_number":4936,"context_line":"Connexion: \u003d?iso8859-1?q?r\u003dE9initialis\u003dE9e_par_l\u003d27homologue?\u003d"},{"line_number":4937,"context_line":"Status: \u003d?utf-8?b?5byA5aeL6YCa6L+H5a+56LGh5aSN5Yi2?\u003d"},{"line_number":4938,"context_line":"Latin-1: Resincronizaci\\xf3n realizada con \\xe9xito"},{"line_number":4939,"context_line":"Utf-8: \\xd0\\xba\\xd0\\xbe\\xd0\\xbd\\xd1\\x82\\xd0\\xb5\\xd0\\xb9\\xd0\\xbd\\xd0\\xb5\\xd1\\x80"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a2fa921_430f70e1","line":4936,"updated":"2015-10-06 08:37:45.000000000","message":"FYI connexion is the french spelling, in english it\u0027s connection ;-) (just in case if you update your patch)","commit_id":"06bede894227062eabceb0fdfac8146cdabf4c8b"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"78df922ad1508c831a9e72b1919f187fae758b47","unresolved":false,"context_lines":[{"line_number":4936,"context_line":"Connexion: \u003d?iso8859-1?q?r\u003dE9initialis\u003dE9e_par_l\u003d27homologue?\u003d"},{"line_number":4937,"context_line":"Status: \u003d?utf-8?b?5byA5aeL6YCa6L+H5a+56LGh5aSN5Yi2?\u003d"},{"line_number":4938,"context_line":"Latin-1: Resincronizaci\\xf3n realizada con \\xe9xito"},{"line_number":4939,"context_line":"Utf-8: \\xd0\\xba\\xd0\\xbe\\xd0\\xbd\\xd1\\x82\\xd0\\xb5\\xd0\\xb9\\xd0\\xbd\\xd0\\xb5\\xd1\\x80"},{"line_number":4940,"context_line":""},{"line_number":4941,"context_line":"This is the body"},{"line_number":4942,"context_line":"\"\"\")"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a2fa921_e369dc8c","line":4939,"updated":"2015-10-06 08:37:45.000000000","message":"Thanks! It\u0027s much better now.","commit_id":"06bede894227062eabceb0fdfac8146cdabf4c8b"}]}
