Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Roman Khabibov <roman.habibov@tarantool.org>
Cc: tarantool-patches@freelists.org, tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] socket: better args handling for connect()/bind()
Date: Fri, 1 Nov 2019 15:32:42 +0300	[thread overview]
Message-ID: <20191101123242.roqd2ayfoopur33o@tkn_work_nb> (raw)
In-Reply-To: <20190910125838.52181-1-roman.habibov@tarantool.org>

Please, rebase your commits on recent master and apply comments below.

> socket: better args handling for connect()/bind()

I would say about validation rather then handling.

>
> Check args types in socket.connect() and socket.bind() functions.
> 'host' should be a string and 'port' should be a string or a
> number.
> 
> Part of #4138

It is better to place this commit before one that closes the issue.

> Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-4138-getaddrinfo
> Issue: https://github.com/tarantool/tarantool/issues/4138

> @@ -1569,7 +1570,8 @@ local function lsocket_connect(host, port)
>  end
>  
>  local function lsocket_bind(host, port, backlog)
> -    if host == nil or port == nil then
> +    if type(host) ~= 'string' or (type(port) ~= 'string' and
> +        type(port) ~= 'number') then

I would check backport against 'number' too (if it present).

> +socket.connect(127.0.0.1, 3301)
> +---
> +- error: '[string "socket.connect(127.0.0.1, 3301) "]:1: malformed number near ''127.0.0.1'''

Did you read this error? It is the parsing error from Lua interpreter.

  reply	other threads:[~2019-11-01 12:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10 12:58 [tarantool-patches] " Roman Khabibov
2019-11-01 12:32 ` Alexander Turenko [this message]
2019-11-21 17:27   ` [Tarantool-patches] " Roman Khabibov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191101123242.roqd2ayfoopur33o@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=roman.habibov@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [Tarantool-patches] [PATCH] socket: better args handling for connect()/bind()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox