Git Product home page Git Product logo

Comments (4)

TysonAndre avatar TysonAndre commented on August 23, 2024

Checking for an invalid number of arguments (e.g. 0 for mget, odd for mset, etc.) is probably doable.

For redis, mget is well-formed (an array *1 with 1 element that's the command name and 0 args), for memcached, get with 0 arguments is not allowed by the protocol but also sending ERROR there may work.

Retrieval command:
------------------

The retrieval commands "get" and "gets" operate like this:

get <key>*\r\n
gets <key>*\r\n

- <key>* means one or more key strings separated by whitespace.
» telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
get   
ERROR
get k
END

from twemproxy.

631086083 avatar 631086083 commented on August 23, 2024

hello, I made a brief modification. When the number of parameters does not match, an error is returned. When a tcp connection is working normally, it will not be actively closed by the proxy, even if a command that does not conform to the rules is sent.

Do you think this can be merged into the master branch?

631086083@3736ff5

from twemproxy.

TysonAndre avatar TysonAndre commented on August 23, 2024

That seems right and I'd probably merge that if I don't find anything else during the review (and the CLA is signed) - it also needs to handle auth in the reply code.

if (r->type == MSG_REQ_REDIS_AUTH && array_len(r->keys) > 0) { is what it should be, I think, see redis_handle_auth_req

127.0.0.1:6379> auth
(error) ERR wrong number of arguments for 'auth' command

from twemproxy.

631086083 avatar 631086083 commented on August 23, 2024

631086083@a7dbaee

This seems to be a very bad implementation. 囧

from twemproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.