)]}'
{"glanceclient/common/http.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4716408358f892a3056bcedd4805f80ce40c1175","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        self.session.headers[\"User-Agent\"] \u003d USER_AGENT"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":"        if self.auth_token:"},{"line_number":67,"context_line":"            # Note(chaochin): X-Auth-Token will be merged to session request"},{"line_number":68,"context_line":"            # header. Also need to encode it, otherwise httplib may complain."},{"line_number":69,"context_line":"            # It is a Python 2 problem only."},{"line_number":70,"context_line":"            self.session.headers[\"X-Auth-Token\"] \u003d \\"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_0426b516","line":67,"updated":"2014-11-20 14:19:06.000000000","message":"s/Note/NOTE/","commit_id":"16a4210396d58f8a7d76a777defdc1addbf21e02"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"6c13b7e04db235326646b30ff7c9afa5cdb82996","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        self.session.headers[\"User-Agent\"] \u003d USER_AGENT"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":"        if self.auth_token:"},{"line_number":67,"context_line":"            # Note(chaochin): X-Auth-Token will be merged to session request"},{"line_number":68,"context_line":"            # header. Also need to encode it, otherwise httplib may complain."},{"line_number":69,"context_line":"            # It is a Python 2 problem only."},{"line_number":70,"context_line":"            self.session.headers[\"X-Auth-Token\"] \u003d \\"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_5c413b0a","line":67,"in_reply_to":"5a890539_0426b516","updated":"2014-11-20 15:24:45.000000000","message":"Done","commit_id":"16a4210396d58f8a7d76a777defdc1addbf21e02"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"6f39371ea25bf3419aa63774df7149af01327582","unresolved":false,"context_lines":[{"line_number":67,"context_line":"            # NOTE(chaochin): X-Auth-Token will be merged to session request"},{"line_number":68,"context_line":"            # header. Also need to encode it, otherwise httplib may complain."},{"line_number":69,"context_line":"            # It is a Python 2 problem only."},{"line_number":70,"context_line":"            self.session.headers[\"X-Auth-Token\"] \u003d \\"},{"line_number":71,"context_line":"                strutils.safe_encode(self.auth_token)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"        self.timeout \u003d float(kwargs.get(\u0027timeout\u0027, 600))"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a930d6b_5141740a","line":70,"updated":"2015-01-20 20:47:22.000000000","message":"You should be able to write this differently\n\n    self.session.headers[\"X-Auth-Token\"] \u003d strutils.safe_encode(\n        self.auth_token)\n\nThat will avoid the terrible \\ which is widely advocated against.","commit_id":"2178a2c28ee436ae52e0762d28df06c4d3375664"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"fc029fe817737ef26d3c5724d3cbeae9c0803374","unresolved":false,"context_lines":[{"line_number":67,"context_line":"            # NOTE(chaochin): X-Auth-Token will be merged to session request"},{"line_number":68,"context_line":"            # header. Also need to encode it, otherwise httplib may complain."},{"line_number":69,"context_line":"            # It is a Python 2 problem only."},{"line_number":70,"context_line":"            self.session.headers[\"X-Auth-Token\"] \u003d \\"},{"line_number":71,"context_line":"                strutils.safe_encode(self.auth_token)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"        self.timeout \u003d float(kwargs.get(\u0027timeout\u0027, 600))"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa81d914_de764506","line":70,"in_reply_to":"1a930d6b_5141740a","updated":"2015-01-27 20:25:51.000000000","message":"Done","commit_id":"2178a2c28ee436ae52e0762d28df06c4d3375664"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"93ccbb296583dbb682093164d2925fc4846abdd5","unresolved":false,"context_lines":[{"line_number":68,"context_line":"            # NOTE(chaochin): X-Auth-Token will be merged to session request"},{"line_number":69,"context_line":"            # header. Also need to encode it, otherwise httplib may complain."},{"line_number":70,"context_line":"            # It is a Python 2 problem only."},{"line_number":71,"context_line":"            self.session.headers[\"X-Auth-Token\"] \u003d encodeutils.safe_encode("},{"line_number":72,"context_line":"                self.auth_token)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"        self.timeout \u003d float(kwargs.get(\u0027timeout\u0027, 600))"}],"source_content_type":"text/x-python","patch_set":13,"id":"baa041b7_be9f6702","line":71,"updated":"2015-04-03 13:08:29.000000000","message":"TBH, this should *decode* the token, which should then be encoded before it leaves python land (hopefully by requests itself). Does requests encode *session* headers for every request?","commit_id":"5298e8c8fee62f4b77a095a84ca8fe7500de45c7"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"bfd76fba4e322461b73e42fe7700a65ff5baf346","unresolved":false,"context_lines":[{"line_number":68,"context_line":"            # NOTE(chaochin): X-Auth-Token will be merged to session request"},{"line_number":69,"context_line":"            # header. Also need to encode it, otherwise httplib may complain."},{"line_number":70,"context_line":"            # It is a Python 2 problem only."},{"line_number":71,"context_line":"            self.session.headers[\"X-Auth-Token\"] \u003d encodeutils.safe_encode("},{"line_number":72,"context_line":"                self.auth_token)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"        self.timeout \u003d float(kwargs.get(\u0027timeout\u0027, 600))"}],"source_content_type":"text/x-python","patch_set":13,"id":"baa041b7_2454681f","line":71,"in_reply_to":"baa041b7_be9f6702","updated":"2015-04-03 14:03:04.000000000","message":"Requests will accept either bytes or strings as headers, but I think we see strings far more often than bytes.\n\nHere\u0027s the thing. The actual problem with everything that is happening here is not the fault of using unicode from self.auth_token. The problem is sending improperly encoded, non-latin-1 text as a header value (in x-image-meta-name).\n\nFinally, I can\u0027t reproduce this problem with the data provided in the issue:\n\n    \u003e\u003e\u003e import requests\n    \u003e\u003e\u003e s \u003d requests.Session()\n    \u003e\u003e\u003e s.headers[\u0027X-Auth-Token\u0027] \u003d u\u0027foo\u0027\n    \u003e\u003e\u003e s.headers[\u0027X-Image-Meta-Name\u0027] \u003d \u0027snapshot-\\xef\\xbc\\xa1\\xef\\xbc\\xa2\\xef\\xbc\\xa3\\xe4\\xb8\\x80\\xe4\\xb8\\x81\\xe4\\xb8\\x83\\xc3\\x87\\xc3\\xa0\\xc3\\xa2\\xef\\xbd\\xb1\\xef\\xbd\\xb2\\xef\\xbd\\xb3\\xd0\\x94\\xd1\\x84\\xd1\\x8d\\xd8\\xa8\\xd8\\xaa\\xd8\\xab\\xe0\\xa4\\x85\\xe0\\xa4\\x87\\xe0\\xa4\\x89\\xe2\\x82\\xac\\xc2\\xa5\\xe5\\x99\\x82\\xe3\\x82\\xbd\\xe5\\x8d\\x81\\xe8\\xb1\\xb9\\xe7\\xab\\xb9\\xe6\\x95\\xb7\u0027\n    \u003e\u003e\u003e s.get(\u0027https://httpbin.org/get\u0027)\n    \u003cResponse [200]\u003e\n    \u003e\u003e\u003e requests.__version__\n    \u00272.6.0\u0027\n\n(At least I can\u0027t do it with generic requests.)","commit_id":"5298e8c8fee62f4b77a095a84ca8fe7500de45c7"}],"tests/test_http.py":[{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"321aea0345e230b0f981158f1d8d5e1940a9fb77","unresolved":false,"context_lines":[{"line_number":146,"context_line":""},{"line_number":147,"context_line":"    def test_token_encoding(self):"},{"line_number":148,"context_line":"        self.assertIsInstance(self.client.session.headers[\"X-Auth-Token\"],"},{"line_number":149,"context_line":"                              str)"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def test_raw_request(self):"},{"line_number":152,"context_line":"        \" Verify the path being used for HTTP requests reflects accurately. \""}],"source_content_type":"text/x-python","patch_set":3,"id":"7a8c0949_969f3e03","line":149,"updated":"2014-10-30 16:11:05.000000000","message":"Shouldn\u0027t we use six.string_types instead of str?","commit_id":"57a43809ebda2f7db20215f4ac57efafc737c850"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"2ea072a7b99ac4b3f9d6e3793caaf956c989a4c7","unresolved":false,"context_lines":[{"line_number":146,"context_line":""},{"line_number":147,"context_line":"    def test_token_encoding(self):"},{"line_number":148,"context_line":"        self.assertIsInstance(self.client.session.headers[\"X-Auth-Token\"],"},{"line_number":149,"context_line":"                              str)"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def test_raw_request(self):"},{"line_number":152,"context_line":"        \" Verify the path being used for HTTP requests reflects accurately. \""}],"source_content_type":"text/x-python","patch_set":3,"id":"7a8c0949_e8d168ce","line":149,"in_reply_to":"7a8c0949_969f3e03","updated":"2014-10-31 15:24:21.000000000","message":"Good point. Done.","commit_id":"57a43809ebda2f7db20215f4ac57efafc737c850"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b41af1bde6ac621c9f18d48f52ed6c67e4a2fd98","unresolved":false,"context_lines":[{"line_number":145,"context_line":"            self.assertEqual(value, encoded[\"test\"])"},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"    def test_token_encoding(self):"},{"line_number":148,"context_line":"        self.assertIsInstance(self.client.session.headers[\"X-Auth-Token\"],"},{"line_number":149,"context_line":"                              six.string_types)"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def test_raw_request(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a8c0949_c91aeb16","line":148,"updated":"2014-10-31 19:55:36.000000000","message":"I removed the change in http.py and this test still passes, so it\u0027s not hitting the failure.","commit_id":"8da37f2d302ea05e04097c90e37cdeaf6fac23b4"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"88ea032607ec0f6f0f9dac536354cf4de5560693","unresolved":false,"context_lines":[{"line_number":145,"context_line":"            self.assertEqual(value, encoded[\"test\"])"},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"    def test_token_encoding(self):"},{"line_number":148,"context_line":"        self.assertIsInstance(self.client.session.headers[\"X-Auth-Token\"],"},{"line_number":149,"context_line":"                              six.string_types)"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def test_raw_request(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a8c0949_6019f687","line":148,"in_reply_to":"7a8c0949_c91aeb16","updated":"2014-11-04 05:58:58.000000000","message":"Thanks for figuring out this issue!","commit_id":"8da37f2d302ea05e04097c90e37cdeaf6fac23b4"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5540e10f20d7d8c2ae71f9984097a96f49b07fa9","unresolved":false,"context_lines":[{"line_number":146,"context_line":""},{"line_number":147,"context_line":"    def test_token_encoding(self):"},{"line_number":148,"context_line":"        self.assertIsInstance(self.client.session.headers[\"X-Auth-Token\"],"},{"line_number":149,"context_line":"                              bytes)"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def test_raw_request(self):"},{"line_number":152,"context_line":"        \" Verify the path being used for HTTP requests reflects accurately. \""}],"source_content_type":"text/x-python","patch_set":5,"id":"7a8c0949_4d7d12b1","line":149,"updated":"2014-11-04 09:48:43.000000000","message":"s/bytes/six.binary_type/?","commit_id":"51b3031fec1f951558a5f91b4d6f000e8f2e2e84"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"5d6e3872a9d322323d6b7c5658eda74943efcf2f","unresolved":false,"context_lines":[{"line_number":151,"context_line":"        else:"},{"line_number":152,"context_line":"            self.assertIsInstance(self.client.session.headers[\"X-Auth-Token\"],"},{"line_number":153,"context_line":"                                  six.string_types)"},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"    def test_raw_request(self):"},{"line_number":156,"context_line":"        \" Verify the path being used for HTTP requests reflects accurately. \""},{"line_number":157,"context_line":"        headers \u003d {\"Content-Type\": \"text/plain\"}"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a890539_088e8927","line":154,"updated":"2014-12-01 13:49:58.000000000","message":"Correct me if I\u0027m wrong, this code is fully equivalent to:\ndef test_token_encoding(self):\n    self.assertIsInstance(self.client.session.headers[\"X-Auth-Token\"], str)\n\nIn PY2 six.binary_type is str and in PY3 six.string_types is also str","commit_id":"665d294f022bd3fa37ee0acfc62f411803d7ebb9"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"f315f09dfa1bd76f05a8cda2596073ff5c4cab18","unresolved":false,"context_lines":[{"line_number":151,"context_line":"        else:"},{"line_number":152,"context_line":"            self.assertIsInstance(self.client.session.headers[\"X-Auth-Token\"],"},{"line_number":153,"context_line":"                                  six.string_types)"},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"    def test_raw_request(self):"},{"line_number":156,"context_line":"        \" Verify the path being used for HTTP requests reflects accurately. \""},{"line_number":157,"context_line":"        headers \u003d {\"Content-Type\": \"text/plain\"}"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a890539_d6c963ad","line":154,"in_reply_to":"5a890539_088e8927","updated":"2014-12-02 10:11:59.000000000","message":"Yes, you are correct... In my patch set 3, I use str here. However,  I did not notice this bug is Python2 only problem at that time. So that I followed your suggest to rework the unit test, and eventually I notice str should be the right one...","commit_id":"665d294f022bd3fa37ee0acfc62f411803d7ebb9"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"93ccbb296583dbb682093164d2925fc4846abdd5","unresolved":false,"context_lines":[{"line_number":168,"context_line":"        self.assertEqual(b\"ni\\xc3\\xb1o\", encoded[b\"test\"])"},{"line_number":169,"context_line":"        self.assertNotIn(\"none-val\", encoded)"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"    def test_token_encoding(self):"},{"line_number":172,"context_line":"        self.assertIsInstance(self.client.session.headers[\"X-Auth-Token\"],"},{"line_number":173,"context_line":"                              six.binary_type)"},{"line_number":174,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"baa041b7_7e78bfc4","line":171,"updated":"2015-04-03 13:08:29.000000000","message":"Could you please add a test with a proper encoding/decoding case?","commit_id":"5298e8c8fee62f4b77a095a84ca8fe7500de45c7"}]}
