)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"8f625d3c53ca58bd9d5d9339c35b4a80beb53629","unresolved":false,"context_lines":[{"line_number":15,"context_line":"    webob.Response object. It appears to be correctly set"},{"line_number":16,"context_line":"    when directly setting the body property."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Upstream change that cased the issues:"},{"line_number":19,"context_line":"  https://github.com/Pylons/webob/commit/35fd585"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Closes-bug: #1657452"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"1a1ced50_755679d3","line":18,"updated":"2017-03-20 13:35:07.000000000","message":"caused*?","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"}],"keystone/common/wsgi.py":[{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"052f42c7ecd1e8dda0bc2bb065747b85b7384a4d","unresolved":false,"context_lines":[{"line_number":763,"context_line":""},{"line_number":764,"context_line":"    headers \u003d _convert_to_str(headers)"},{"line_number":765,"context_line":"    if isinstance(body, six.text_type):"},{"line_number":766,"context_line":"        body \u003d body.encode(\u0027utf-8\u0027)"},{"line_number":767,"context_line":""},{"line_number":768,"context_line":"    resp \u003d webob.Response(body\u003dbody,"},{"line_number":769,"context_line":"                          status\u003d\u0027%d %s\u0027 % status,"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_f3df020a","line":766,"updated":"2017-02-02 21:50:31.000000000","message":"The WebOb spec for the body parameter says \"If body is a text_type, then it will be encoded using either charset when provided or default_encoding when charset is not provided if the content_type allows for a charset.\" So it seems to me this should be setting the charset to utf-8 and allowing WebOb perform the encoding. Setting the charset has other advantages well because it allows WebOb to have more information when it automatically performs certain operations.","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"},{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"06e913f400f04b7cf3c31a0bd6e28add84a8c983","unresolved":false,"context_lines":[{"line_number":763,"context_line":""},{"line_number":764,"context_line":"    headers \u003d _convert_to_str(headers)"},{"line_number":765,"context_line":"    if isinstance(body, six.text_type):"},{"line_number":766,"context_line":"        body \u003d body.encode(\u0027utf-8\u0027)"},{"line_number":767,"context_line":""},{"line_number":768,"context_line":"    resp \u003d webob.Response(body\u003dbody,"},{"line_number":769,"context_line":"                          status\u003d\u0027%d %s\u0027 % status,"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a430d35_e1d664c4","line":766,"in_reply_to":"1a430d35_0249b35f","updated":"2017-02-04 00:36:59.000000000","message":"David, one change I noticed in WebOb 1.7.0 is if there is no body then no Content-Length header is added. Is that the problem you\u0027re trying to solve? I noticed it affects the test_render_response_no_body() test in test_wsgi.py. My understanding is the absence of the Content-Length header is permissible when there is no body. See https://www.w3.org/Protocols/HTTP/1.0/draft-ietf-http-spec.html#Entity-Body.","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"},{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"9d703babd10a7e1a1b377a7fb99cc1b9bd83524e","unresolved":false,"context_lines":[{"line_number":763,"context_line":""},{"line_number":764,"context_line":"    headers \u003d _convert_to_str(headers)"},{"line_number":765,"context_line":"    if isinstance(body, six.text_type):"},{"line_number":766,"context_line":"        body \u003d body.encode(\u0027utf-8\u0027)"},{"line_number":767,"context_line":""},{"line_number":768,"context_line":"    resp \u003d webob.Response(body\u003dbody,"},{"line_number":769,"context_line":"                          status\u003d\u0027%d %s\u0027 % status,"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a430d35_0249b35f","line":766,"in_reply_to":"1a430d35_ab4e0abf","updated":"2017-02-03 22:52:13.000000000","message":"Hi David, yes I read the commit message but I think some erroneous conclusions have been drawn.\n\nYou need to pass the charset parameter to the Response constructor and it will perform the encoding.\n\nThe Response constructor also allows you to pass the content_type and it has smarts enough to add the charset to it and to add it to the headers, however it only does this if you don\u0027t pass a headerlist because it presumes the act of passing in headers implies you know better what the headers need to be. If there is only the need to add a content-type header it\u0027s better to pass it as a keyword arg and allow the Response object to manage it rather than a headerlist containing only a content-type. However, this does not apply to this particular use of the Response object because we must add other headers, therefore we must include the content-type in the headerlist.\n\nOne minor problem with the content-type that is hardcoded is it omits the charset parameter. It defaults to utf-8 for JSON so it\u0027s probably not a big deal but in the interest of completeness the charset should be explicit.\n\nPassing in a headerlist does not prevent the content-length from being added to the headers.\n\nBelow is a tiny Python program that illustrates these points\n\n----------------------------------\nfrom webob.response import Response\n\nbody \u003d u\u0027foobar\u0027\n\nheaders \u003d []\nheaders.append((\u0027Vary\u0027, \u0027X-Auth-Token\u0027))\nheaders.append((\u0027Content-Type\u0027, \u0027application/json; charset\u003dutf-8\u0027))\n\nresponse \u003d Response(body\u003dbody,\n                    charset\u003d\u0027utf-8\u0027,\n                    headerlist\u003dheaders\n                    )\n\nprint response.body.__class__\nprint response\n----------------------------------\n\nThis is the output:\n\n----------------------------------\n\u003ctype \u0027str\u0027\u003e\n200 OK\nVary: X-Auth-Token\nContent-Type: application/json; charset\u003dutf-8\nContent-Length: 6\n\nfoobar\n----------------------------------\nWe can see that the unicode body was encoded (because body is now a str type and the Content-Length is correctly set.\n\nI tested this against the master branch of WebOb. If there is some version of WebOb that is not behaving this way then it\u0027s WebOb that needs fixing.\n\nIn summary I think the actual fix is to add the charset keyword parameter to the Response object and it would be wise but not essential to also add the charset parameter to the Content-Type header.","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"372cd063a62c1ce05581926afec0069175e51c05","unresolved":false,"context_lines":[{"line_number":763,"context_line":""},{"line_number":764,"context_line":"    headers \u003d _convert_to_str(headers)"},{"line_number":765,"context_line":"    if isinstance(body, six.text_type):"},{"line_number":766,"context_line":"        body \u003d body.encode(\u0027utf-8\u0027)"},{"line_number":767,"context_line":""},{"line_number":768,"context_line":"    resp \u003d webob.Response(body\u003dbody,"},{"line_number":769,"context_line":"                          status\u003d\u0027%d %s\u0027 % status,"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a1ced50_4a4b8587","line":766,"in_reply_to":"1a430d35_e1d664c4","updated":"2017-03-20 21:58:10.000000000","message":"Isn\u0027t \u0027utf-8\u0027 the default charset according to the WebOb implementation? \n\nhttps://github.com/Pylons/webob/commit/35fd585","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"494a7612e9558f1db1eb45ae5e9aa5a70d4eb3ed","unresolved":false,"context_lines":[{"line_number":763,"context_line":""},{"line_number":764,"context_line":"    headers \u003d _convert_to_str(headers)"},{"line_number":765,"context_line":"    if isinstance(body, six.text_type):"},{"line_number":766,"context_line":"        body \u003d body.encode(\u0027utf-8\u0027)"},{"line_number":767,"context_line":""},{"line_number":768,"context_line":"    resp \u003d webob.Response(body\u003dbody,"},{"line_number":769,"context_line":"                          status\u003d\u0027%d %s\u0027 % status,"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a430d35_ab4e0abf","line":766,"in_reply_to":"3a461143_f3df020a","updated":"2017-02-03 16:42:25.000000000","message":"@John, The commit I mention in the commit message shows what WebOb actually does. It will not deal with the encoding if you are adding headers.","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"},{"author":{"_account_id":6482,"name":"Steve Martinelli","email":"s.martinelli@gmail.com","username":"stevemar"},"change_message_id":"d8d711a96afa38ad4bf0cb7468b6fe43d044186d","unresolved":false,"context_lines":[{"line_number":768,"context_line":"    resp \u003d webob.Response(body\u003dbody,"},{"line_number":769,"context_line":"                          status\u003d\u0027%d %s\u0027 % status,"},{"line_number":770,"context_line":"                          headerlist\u003dheaders,"},{"line_number":771,"context_line":"                          content_length\u003dlen(body))"},{"line_number":772,"context_line":""},{"line_number":773,"context_line":"    if method and method.upper() \u003d\u003d \u0027HEAD\u0027:"},{"line_number":774,"context_line":"        # NOTE(morganfainberg): HEAD requests should return the same status"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_657efeaf","line":771,"range":{"start_line":771,"start_character":26,"end_line":771,"end_character":51},"updated":"2017-02-02 14:39:19.000000000","message":"why add content_length here? it\u0027s not added to the other webob.Responses?","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"},{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"052f42c7ecd1e8dda0bc2bb065747b85b7384a4d","unresolved":false,"context_lines":[{"line_number":768,"context_line":"    resp \u003d webob.Response(body\u003dbody,"},{"line_number":769,"context_line":"                          status\u003d\u0027%d %s\u0027 % status,"},{"line_number":770,"context_line":"                          headerlist\u003dheaders,"},{"line_number":771,"context_line":"                          content_length\u003dlen(body))"},{"line_number":772,"context_line":""},{"line_number":773,"context_line":"    if method and method.upper() \u003d\u003d \u0027HEAD\u0027:"},{"line_number":774,"context_line":"        # NOTE(morganfainberg): HEAD requests should return the same status"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_7e3cb9bf","line":771,"range":{"start_line":771,"start_character":26,"end_line":771,"end_character":51},"in_reply_to":"3a461143_657efeaf","updated":"2017-02-02 21:50:31.000000000","message":"The WebOb doc says the content_length is automatically set if you set the body, if the Content-Length is not being set correctly by WebOb this seems to be a bug that needs to get fixed in WebOb not here.","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"494a7612e9558f1db1eb45ae5e9aa5a70d4eb3ed","unresolved":false,"context_lines":[{"line_number":768,"context_line":"    resp \u003d webob.Response(body\u003dbody,"},{"line_number":769,"context_line":"                          status\u003d\u0027%d %s\u0027 % status,"},{"line_number":770,"context_line":"                          headerlist\u003dheaders,"},{"line_number":771,"context_line":"                          content_length\u003dlen(body))"},{"line_number":772,"context_line":""},{"line_number":773,"context_line":"    if method and method.upper() \u003d\u003d \u0027HEAD\u0027:"},{"line_number":774,"context_line":"        # NOTE(morganfainberg): HEAD requests should return the same status"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a430d35_ab20caf8","line":771,"in_reply_to":"3a461143_7e3cb9bf","updated":"2017-02-03 16:42:25.000000000","message":"@Steve, Which other responses? I thought I got them all?\n\n@John, The commit I mention in the commit message shows what WebOb actually does. It will not add content-length if you are providing headers.","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"}],"keystone/federation/controllers.py":[{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"052f42c7ecd1e8dda0bc2bb065747b85b7384a4d","unresolved":false,"context_lines":[{"line_number":355,"context_line":"        subs \u003d {\u0027host\u0027: host, \u0027token\u0027: token_id}"},{"line_number":356,"context_line":"        body \u003d src.substitute(subs)"},{"line_number":357,"context_line":"        if isinstance(body, six.text_type):"},{"line_number":358,"context_line":"            body \u003d body.encode(\u0027utf-8\u0027)"},{"line_number":359,"context_line":"        return webob.Response(body\u003dbody, status\u003d\u0027200\u0027,"},{"line_number":360,"context_line":"                              headerlist\u003dheaders)"},{"line_number":361,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_7e9e7955","line":358,"updated":"2017-02-02 21:50:31.000000000","message":"See prior comment, shouldn\u0027t you be setting the response charset and let WebOb take care of the rest?","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"},{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"9d703babd10a7e1a1b377a7fb99cc1b9bd83524e","unresolved":false,"context_lines":[{"line_number":357,"context_line":"        if isinstance(body, six.text_type):"},{"line_number":358,"context_line":"            body \u003d body.encode(\u0027utf-8\u0027)"},{"line_number":359,"context_line":"        return webob.Response(body\u003dbody, status\u003d\u0027200\u0027,"},{"line_number":360,"context_line":"                              headerlist\u003dheaders)"},{"line_number":361,"context_line":""},{"line_number":362,"context_line":"    def _create_base_saml_assertion(self, context, auth):"},{"line_number":363,"context_line":"        issuer \u003d CONF.saml.idp_entity_id"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a430d35_82f843e7","line":360,"updated":"2017-02-03 22:52:13.000000000","message":"See prior comment concerning the wisdom of using the content_type keyword parameter when the only header to add is Content-Type, the Response object also needs the charset parameter added.","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"}],"keystone/token/_simple_cert.py":[{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"052f42c7ecd1e8dda0bc2bb065747b85b7384a4d","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        # that we don\u0027t pass through the JSON encoding process."},{"line_number":85,"context_line":"        headers \u003d [(\u0027Content-Type\u0027, \u0027application/x-pem-file\u0027)]"},{"line_number":86,"context_line":"        if isinstance(body, six.text_type):"},{"line_number":87,"context_line":"            body \u003d body.encode(\u0027utf-8\u0027)"},{"line_number":88,"context_line":"        return webob.Response(body\u003dbody, headerlist\u003dheaders, status\u003d\"200 OK\")"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"    def get_ca_certificate(self, context):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_9e4965d3","line":87,"updated":"2017-02-02 21:50:31.000000000","message":"See prior comment considering setting charset instead of encoding body.","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"},{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"9d703babd10a7e1a1b377a7fb99cc1b9bd83524e","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        headers \u003d [(\u0027Content-Type\u0027, \u0027application/x-pem-file\u0027)]"},{"line_number":86,"context_line":"        if isinstance(body, six.text_type):"},{"line_number":87,"context_line":"            body \u003d body.encode(\u0027utf-8\u0027)"},{"line_number":88,"context_line":"        return webob.Response(body\u003dbody, headerlist\u003dheaders, status\u003d\"200 OK\")"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"    def get_ca_certificate(self, context):"},{"line_number":91,"context_line":"        return self._get_certificate(CONF.signing.ca_certs)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a430d35_e2be67fe","line":88,"updated":"2017-02-03 22:52:13.000000000","message":"See prior comment concerning the wisdom of using the content_type keyword parameter when the only header to add is Content-Type, the Response object also needs the charset parameter added.","commit_id":"4fee4a776debd801c4bc276601f99a48b4be6a7c"}]}
