From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 5D4E94C889; Thu, 14 Jan 2021 11:47:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5D4E94C889 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1610614057; bh=CiVdfwkCfVUsDEsQIQLjJ5r/oIOHoMkTyEwaWHdAG18=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=BK6l+rPWEs3hUtZKMvQv4cMu1vEop7fjm+dEzUp6LGe865/50FOnkb8I3/Gg5PyG9 3ITrpr9MyALbj0iknfogFExDAw7Ev1PRf+NqbRflXMepgcKXpAzZsClpi+xCNpYeQ7 Jvzq/0hYEwNvCmqk57TI2dOitrcXKWISgBRfrspY= Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [94.100.177.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 34DF94C885 for ; Thu, 14 Jan 2021 11:47:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 34DF94C885 Received: by smtp32.i.mail.ru with esmtpa (envelope-from ) id 1kzyI2-0006ni-3H; Thu, 14 Jan 2021 11:47:34 +0300 To: sergeyb@tarantool.org, tarantool-patches@dev.tarantool.org Cc: Sergey Bronnikov , alexander.turenko@tarantool.org References: Message-ID: <7a67487e-5f8c-3399-1ac0-fb085b83d4f7@tarantool.org> Date: Thu, 14 Jan 2021 11:47:19 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D0E79FBC973162CD9B382B274FF537389656BC690FF7BBE200894C459B0CD1B95CB79969572491D62EE07DC4C0F03D0141B91D94412F7D5963644CC1B0E3E507 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70043D879A87EF1BCEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371E8C7BD479B346ED8638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC0C6E0E68801B4CDCCB46C4ADEE6FC00E53663FD7663FE009389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0D9442B0B5983000E8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C061CD53100284B95B7B076A6E789B0E97A8DF7F3B2552694A1E7802607F20496D49FD398EE364050F140C956E756FBB7AE0F2381F647739FAB3661434B16C20AC78D18283394535A975ECD9A6C639B01BC09775C1D3CA48CF4AD8DB2B056B32D9089D37D7C0E48F6CCF19DD082D7633A0E7DDDDC251EA7DABAAAE862A0553A3920E30A4C9C8E338DA2B32DCB92A8600C6C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-B7AD71C0: 6FEFE4C63DFE2D85469AD6E133326EAB664F5199923B286EEC27507A4F178EF7B0B0D2FE507DA31E6B887D30E683EA2C X-C1DE0DAB: 0D63561A33F958A568D31C8C9C1CCEFF8011EA8C3E1F4475F7B2D7A6E227879ED59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA758F9E841AEAEC4F2C410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34324A9840C798D5001B89E0F6687456F2285AAFB64BED816DF10B664BE2AEBE61F713BE24D97D35021D7E09C32AA3244CFA4C08AFB77FFD6822FF6B4830AA21653A92A9747B6CC886927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj9kdO2HH36x5jn2hcz/bL5Q== X-Mailru-Sender: 48EFD2E18A91C559803250E574CC3D29323CEEA5DDE99B8403EFED2893899458228AB1844EA588C7D35D514C7DAC97282D063C67CFD4E84987597EC79699C0E6F21BD4036121A32F7402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 1/4] test: fix app-tap/http_client.test.lua X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Leonid Vasiliev via Tarantool-patches Reply-To: Leonid Vasiliev Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thank you for the patch. Generally LGTM. See some comments below: On 13.01.2021 11:48, sergeyb@tarantool.org wrote: > From: Sergey Bronnikov > > Pass http body as byte string and define string literals correctly. > > Part of #5538 AFAIU, if the task has been closed, new patches corresponding with the task are marked as "Follows up". > --- > test/app-tap/httpd.py | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/test/app-tap/httpd.py b/test/app-tap/httpd.py > index a2dee1b83..62435e91a 100755 > --- a/test/app-tap/httpd.py > +++ b/test/app-tap/httpd.py > @@ -7,24 +7,24 @@ from gevent import spawn, sleep, socket > def absent(): > code = "500 Server Error" > headers = [("Content-Type", "application/json")] > - body = ["No such method"] > + body = [b'No such method'] > return code, body, headers > > def hello(): > code = "200 OK" > - body = ["hello world"] > + body = [b'hello world'] > headers = [("Content-Type", "application/json")] > return code, body, headers > > def hello1(): > code = "200 OK" > - body = [b"abc"] > + body = [b'abc'] > headers = [("Content-Type", "application/json")] > return code, body, headers > > def headers(): > code = "200 OK" > - body = [b"cookies"] > + body = [b'cookies'] > headers = [("Content-Type", "application/json"), > ("Content-Type", "application/yaml"), > ("Set-Cookie", "likes=cheese; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly"), > @@ -41,13 +41,13 @@ def headers(): > def long_query(): > sleep(0.005) > code = "200 OK" > - body = [b"abc"] > + body = [b'abc'] > headers = [("Content-Type", "application/json")] > return code, body, headers > > def redirect(): > code = "302 Found" > - body = ["redirecting"] > + body = [b'redirecting'] > headers = [("Location", "/")] > return code, body, headers > > @@ -63,7 +63,7 @@ paths = { > def read_handle(env, response): > code = "404 Not Found" > headers = [] > - body = ["Not Found"] > + body = [b'Not Found'] > if env["PATH_INFO"] in paths: > code, body, headers = paths[env["PATH_INFO"]]() > for key,value in iter(env.items()): > @@ -76,7 +76,7 @@ def post_handle(env, response): > code = "200 OK" > body = [env["wsgi.input"].read()] > headers = [] > - for key,value in env.iteritems(): > + for key,value in iter(env.items()): This change is not about "Pass http body as byte string and define string literals correctly." Please edit the commit message or move this change to a separate commit. > if "HTTP_" in key: > headers.append((key[5:].lower(), value)) > response(code, headers) > @@ -84,8 +84,8 @@ def post_handle(env, response): > > def other_handle(env, response, method, code): > headers = [("Content-Type", "text/plain"), ("method", method)] > - body = [method] > - for key,value in env.iteritems(): > + body = [method.encode('utf-8')] > + for key,value in iter(env.items()): This change is not about "Pass http body as byte string and define string literals correctly." Please edit the commit message or move this change to a separate commit. > if "HTTP_" in key: > headers.append((key[5:].lower(), value)) > response(code, headers) >