)]}'
{"swiftclient/client.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"a8aef13b3e12fa1fba5eb0630fe2bce004bfe175","unresolved":false,"context_lines":[{"line_number":1031,"context_line":"    :param chunk_size: chunk size of data to write; it defaults to 65536;"},{"line_number":1032,"context_line":"                       used only if the contents object has a \u0027read\u0027"},{"line_number":1033,"context_line":"                       method, e.g. file-like objects, ignored otherwise"},{"line_number":1034,"context_line":"    :param content_type: value to send as content-type header; if None, an"},{"line_number":1035,"context_line":"                         empty string value will be sent"},{"line_number":1036,"context_line":"    :param headers: additional headers to include in the request, if any"},{"line_number":1037,"context_line":"    :param http_conn: HTTP connection object (If None, it will create the"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a2fa921_184e8c96","line":1034,"updated":"2015-10-07 11:48:35.000000000","message":"need to update this param doc","commit_id":"1725f0c6b2a4baf178a769a19b9b643b409c0a06"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"a8aef13b3e12fa1fba5eb0630fe2bce004bfe175","unresolved":false,"context_lines":[{"line_number":1082,"context_line":"        for n, v in headers.items():"},{"line_number":1083,"context_line":"            if n.lower() \u003d\u003d \u0027content-type\u0027:"},{"line_number":1084,"context_line":"                content_type \u003d v"},{"line_number":1085,"context_line":"        headers[\u0027Content-Type\u0027] \u003d content_type"},{"line_number":1086,"context_line":"    if not contents:"},{"line_number":1087,"context_line":"        headers[\u0027Content-Length\u0027] \u003d \u00270\u0027"},{"line_number":1088,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a2fa921_38826895","line":1085,"updated":"2015-10-07 11:48:35.000000000","message":"this adds a title-case header potentially duplicating the lower case header, which is unnecessary. See suggestion in linked paste.","commit_id":"1725f0c6b2a4baf178a769a19b9b643b409c0a06"},{"author":{"_account_id":18015,"name":"Peter Lisák","email":"peter.lisak@gmail.com","username":"peter.lisak"},"change_message_id":"bdfe2714ca7c33983e58e3bc8b46d6ba7b2e740f","unresolved":false,"context_lines":[{"line_number":1082,"context_line":"        for n, v in headers.items():"},{"line_number":1083,"context_line":"            if n.lower() \u003d\u003d \u0027content-type\u0027:"},{"line_number":1084,"context_line":"                content_type \u003d v"},{"line_number":1085,"context_line":"        headers[\u0027Content-Type\u0027] \u003d content_type"},{"line_number":1086,"context_line":"    if not contents:"},{"line_number":1087,"context_line":"        headers[\u0027Content-Length\u0027] \u003d \u00270\u0027"},{"line_number":1088,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a2fa921_655b5455","line":1085,"in_reply_to":"7a2fa921_38826895","updated":"2015-10-07 12:29:11.000000000","message":"Thanks for suggestion!\nThere should be also added `headers.pop(\u0027content-length\u0027, None)` below line 1070, shouldn\u0027t be?? It is fairly similar title-case duplicating header problem.","commit_id":"1725f0c6b2a4baf178a769a19b9b643b409c0a06"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"8ef7a6c85ec1f498999ddf69a82b2a99662edc54","unresolved":false,"context_lines":[{"line_number":1082,"context_line":"        for n, v in headers.items():"},{"line_number":1083,"context_line":"            if n.lower() \u003d\u003d \u0027content-type\u0027:"},{"line_number":1084,"context_line":"                content_type \u003d v"},{"line_number":1085,"context_line":"        headers[\u0027Content-Type\u0027] \u003d content_type"},{"line_number":1086,"context_line":"    if not contents:"},{"line_number":1087,"context_line":"        headers[\u0027Content-Length\u0027] \u003d \u00270\u0027"},{"line_number":1088,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a2fa921_48dd0fdf","line":1085,"in_reply_to":"7a2fa921_655b5455","updated":"2015-10-07 12:45:42.000000000","message":"Yes. And 1064, 1066 etc. But you don;t have to fix all of those in this patch IMHO :)\n\nIn fact a general solution throughout this class would be to use CaseInsensitiveDict from requests library, but that may be well beyond the scope of that you want to achieve with this patch. Perhaps a useful follow on patch.","commit_id":"1725f0c6b2a4baf178a769a19b9b643b409c0a06"},{"author":{"_account_id":16896,"name":"Ondřej Nový","email":"novy@ondrej.org","username":"onovy"},"change_message_id":"85416d0a50266446806925acfa29d1bf84ce14db","unresolved":false,"context_lines":[{"line_number":1077,"context_line":"                content_length \u003d int(v)"},{"line_number":1078,"context_line":"    if content_type is not None:"},{"line_number":1079,"context_line":"        headers[\u0027Content-Type\u0027] \u003d content_type"},{"line_number":1080,"context_line":"        headers.pop(\u0027content-type\u0027, None)"},{"line_number":1081,"context_line":"    elif \u0027content-type\u0027 not in map(str.lower, headers.keys()):"},{"line_number":1082,"context_line":"        # python-requests sets application/x-www-form-urlencoded otherwise"},{"line_number":1083,"context_line":"        headers[\u0027Content-Type\u0027] \u003d \u0027\u0027"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_400e86e6","line":1080,"updated":"2015-10-12 18:08:32.000000000","message":"what if headers already contains \"content-Type\" or \"cOntent-type\" ? :)","commit_id":"e3f27bacce74138cdb2716ff453cb1ca8d1d56e3"},{"author":{"_account_id":18015,"name":"Peter Lisák","email":"peter.lisak@gmail.com","username":"peter.lisak"},"change_message_id":"98eea88532e8dacebd0ceba3d5bc79293a9eb47a","unresolved":false,"context_lines":[{"line_number":1077,"context_line":"                content_length \u003d int(v)"},{"line_number":1078,"context_line":"    if content_type is not None:"},{"line_number":1079,"context_line":"        headers[\u0027Content-Type\u0027] \u003d content_type"},{"line_number":1080,"context_line":"        headers.pop(\u0027content-type\u0027, None)"},{"line_number":1081,"context_line":"    elif \u0027content-type\u0027 not in map(str.lower, headers.keys()):"},{"line_number":1082,"context_line":"        # python-requests sets application/x-www-form-urlencoded otherwise"},{"line_number":1083,"context_line":"        headers[\u0027Content-Type\u0027] \u003d \u0027\u0027"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_00b08e8a","line":1080,"in_reply_to":"7a2fa921_400e86e6","updated":"2015-10-12 18:23:35.000000000","message":"Of course, but imho it is sufficient for this patch. All headers are processed like that here. I could fixed it all in the following patch.\n\nSee comments in Patch Set 1","commit_id":"e3f27bacce74138cdb2716ff453cb1ca8d1d56e3"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"427867c127b1a95fecd8e3944b53d786878831d2","unresolved":false,"context_lines":[{"line_number":1075,"context_line":"    if content_type is not None:"},{"line_number":1076,"context_line":"        headers[\u0027Content-Type\u0027] \u003d content_type"},{"line_number":1077,"context_line":"        headers.pop(\u0027content-type\u0027, None)"},{"line_number":1078,"context_line":"    elif \u0027content-type\u0027 not in map(str.lower, headers.keys()):"},{"line_number":1079,"context_line":"        # python-requests sets application/x-www-form-urlencoded otherwise"},{"line_number":1080,"context_line":"        headers[\u0027Content-Type\u0027] \u003d \u0027\u0027"},{"line_number":1081,"context_line":"    if not contents:"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a29b11f_18a3c501","line":1078,"updated":"2015-10-21 00:16:02.000000000","message":"When testing this code, I get:\n\n  $ swift upload con obj -H \"content-type:text/plain\"\n  descriptor \u0027lower\u0027 requires a \u0027str\u0027 object but received a \u0027unicode\u0027\n\nOn further inspection, no matter how I pass in the content-type header, it always get camel cased to \"Content-Type\": \n\n  $ for x in \u0027content-type\u0027 \u0027Content-Type\u0027 \u0027CONtent-tyPE\u0027 \u0027CONTENT-TYPE\u0027:; do swift upload con rd_1M -H \"$x:text/plain\"; echo \"---------------------------------\"; done\n  HEADERS: x-object-meta-mtime: 1425599746.473290\n  HEADERS: Content-Length: 1048576\n  HEADERS: Content-Type: text/plain\n  HEADERS: X-Auth-Token:   AUTH_tkbacd51165d2b4add9020920ee1bbae66\n  descriptor \u0027lower\u0027 requires a \u0027str\u0027 object but received a \u0027unicode\u0027\n  ---------------------------------\n  HEADERS: x-object-meta-mtime: 1425599746.473290\n  HEADERS: Content-Length: 1048576\n  HEADERS: Content-Type: text/plain\n  HEADERS: X-Auth-Token: AUTH_tkbacd51165d2b4add9020920ee1bbae66\n  descriptor \u0027lower\u0027 requires a \u0027str\u0027 object but received a \u0027unicode\u0027\n  ---------------------------------\n  HEADERS: x-object-meta-mtime: 1425599746.473290\n  HEADERS: Content-Length: 1048576\n  HEADERS: Content-Type: text/plain\n  HEADERS: X-Auth-Token:   AUTH_tkbacd51165d2b4add9020920ee1bbae66\n  descriptor \u0027lower\u0027 requires a \u0027str\u0027 object but received a \u0027unicode\u0027\n  ---------------------------------\n  HEADERS: x-object-meta-mtime: 1425599746.473290\n  HEADERS: Content-Length: 1048576\n  HEADERS: Content-Type: :text/plain\n  HEADERS: X-Auth-Token:   AUTH_tkbacd51165d2b4add9020920ee1bbae66\n  descriptor \u0027lower\u0027 requires a \u0027str\u0027 object but received a \u0027unicode\u0027\n  ---------------------------------\n\nNOTE: I simply hacked to source to print out the headers: http://paste.openstack.org/show/476936/\n\nThis means the lower case check isn\u0027t required. So we could just use:\n\n  elif \u0027Content-Type\u0027 not in headers:\n     \u003cblah\u003e\n\nFurther it means that the pop on 1077 also doesn\u0027t actually pop the content-type off... which is good, but means it isn\u0027t required.","commit_id":"a6f846f661e8f39122c8389294c8355e1ecf4b23"}],"tests/functional/test_swiftclient.py":[{"author":{"_account_id":16896,"name":"Ondřej Nový","email":"novy@ondrej.org","username":"onovy"},"change_message_id":"85416d0a50266446806925acfa29d1bf84ce14db","unresolved":false,"context_lines":[{"line_number":238,"context_line":"        self.assertEqual(self.etag, hdrs.get(\u0027etag\u0027))"},{"line_number":239,"context_line":"        self.assertEqual(\u0027text/plain\u0027,"},{"line_number":240,"context_line":"                         hdrs.get(\u0027content-type\u0027))"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"        # Same but with content-length"},{"line_number":243,"context_line":"        self.conn.put_object("},{"line_number":244,"context_line":"            self.containername, self.objectname,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_c0c7f662","line":241,"updated":"2015-10-12 18:08:32.000000000","message":"i think you should test that case insensitivity too. so try (same) combination with Content-Type","commit_id":"e3f27bacce74138cdb2716ff453cb1ca8d1d56e3"}],"tests/unit/test_swiftclient.py":[{"author":{"_account_id":16896,"name":"Ondřej Nový","email":"novy@ondrej.org","username":"onovy"},"change_message_id":"85416d0a50266446806925acfa29d1bf84ce14db","unresolved":false,"context_lines":[{"line_number":964,"context_line":"        request_header \u003d resp.requests_params[\u0027headers\u0027]"},{"line_number":965,"context_line":"        self.assertEqual(request_header[\u0027content-type\u0027], b\u0027text/plain\u0027)"},{"line_number":966,"context_line":""},{"line_number":967,"context_line":"        # method param overrides headers"},{"line_number":968,"context_line":"        c.put_object(url\u003d\u0027http://www.test.com\u0027, http_conn\u003dconn, headers\u003dhdrs,"},{"line_number":969,"context_line":"                     content_type\u003d\u0027image/jpeg\u0027)"},{"line_number":970,"context_line":"        request_header \u003d resp.requests_params[\u0027headers\u0027]"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_60862215","line":967,"updated":"2015-10-12 18:08:32.000000000","message":"this test should be here twice, with Content-Type in hdrs dict too.","commit_id":"e3f27bacce74138cdb2716ff453cb1ca8d1d56e3"}]}
