Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tml <tarantool-patches@freelists.org>,
	Alexander Turenko <alexander.turenko@tarantool.org>,
	Kirill Yukhin <kyukhin@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 3/3] box/lua/console: Verify remote protocol for compatibility
Date: Sat, 13 Jul 2019 00:51:40 +0300	[thread overview]
Message-ID: <20190712215140.GH4602@uranus.lan> (raw)
In-Reply-To: <20190712204904.GA32340@atlas>

On Fri, Jul 12, 2019 at 11:49:04PM +0300, Konstantin Osipov wrote:
> * Konstantin Osipov <kostja@tarantool.org> [19/07/12 23:47]:
> > > +local function output_verify_remote(greeting)
> > > +    --
> > > +    -- In case if remote peer is operating over
> > > +    -- old yaml protocol we are unable to decode
> > > +    -- it to non-yaml serializers.
> > > +    if greeting.protocol == 'Lua console' then
> > > +        local d = box.session.storage.console_output
> > > +        if d ~= nil and d["fmt"] == "lua" then
> > > +            local msg1 = "Peer uses deprecated '%s' protocol. "
> > > +            local msg2 = "Switch output to 'yaml' format to proceed."
> > > +            return false, msg1:format(greeting.protocol) .. msg2
> > > +        end
> > > +    end
> > > +    return true, nil
> > > +end
> > 
> > what is the problem with doing yaml.load and serpent.encode for
> > such peers?

'Lua console' proto is depecated, binary proto is preferred and
I think we may simply get rid it, otherwise a way more code is
needed here which I would try to escape.

> > 
> > What if it's a new peer but using yaml output?

Every new connection does this check so that if peer is
reporting old text protocol we refuse to connect until
local output set back to yaml.

> 
> Moreover, shouldn't the output setting affect only the local
> server output, but not subsequent console.connect() calls? 

Not sure I follow here. This code checks for reply from remote
peer, every output bound to a session, and every connection
is a new session (no?) thus we do test each time. Or you meant
something different?

      reply	other threads:[~2019-07-12 21:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 19:04 [tarantool-patches] [PATCH v3 0/3] box/lua/console: Add initial support for lua output format Cyrill Gorcunov
2019-07-12 19:04 ` [tarantool-patches] [PATCH 1/3] third_party/serpent: Add serpent repo Cyrill Gorcunov
2019-07-12 19:04 ` [tarantool-patches] [PATCH 2/3] box/lua/console: Add support for lua output format Cyrill Gorcunov
2019-07-12 20:45   ` [tarantool-patches] " Konstantin Osipov
2019-07-12 21:44     ` Cyrill Gorcunov
2019-07-12 19:04 ` [tarantool-patches] [PATCH 3/3] box/lua/console: Verify remote protocol for compatibility Cyrill Gorcunov
2019-07-12 20:47   ` [tarantool-patches] " Konstantin Osipov
2019-07-12 20:49     ` Konstantin Osipov
2019-07-12 21:51       ` Cyrill Gorcunov [this message]

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=20190712215140.GH4602@uranus.lan \
    --to=gorcunov@gmail.com \
    --cc=alexander.turenko@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH 3/3] box/lua/console: Verify remote protocol for compatibility' \
    /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