mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Handle Redis protocol message
separately
Closes #4504 Messages are not typical responses, so they need special handling. This is different between RESP2 and 3, so this is the first instance where the script layer needs to tell the difference.
This commit is contained in:
parent
8b914f4714
commit
a4ce682bc9
13 changed files with 207 additions and 17 deletions
16
testing/btest/scripts/base/protocols/redis/pubsub-resp3.zeek
Normal file
16
testing/btest/scripts/base/protocols/redis/pubsub-resp3.zeek
Normal file
|
@ -0,0 +1,16 @@
|
|||
# @TEST-DOC: Test Zeek parsing pubsub commands in RESP3
|
||||
# @TEST-REQUIRES: have-spicy
|
||||
#
|
||||
# @TEST-EXEC: zeek -b -r $TRACES/redis/pubsub-resp3.pcap %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Test pub/sub from Redis. This has two subscribers, one using a pattern. Then, the
|
||||
# messages that were published get printed to output.
|
||||
|
||||
@load base/protocols/redis
|
||||
|
||||
event Redis::server_push(c: connection, data: Redis::ReplyData)
|
||||
{
|
||||
# The first 2 are SUBSCRIBE replies, the other 3 are message and pmessage
|
||||
print "Got published data!", data;
|
||||
}
|
|
@ -5,8 +5,12 @@
|
|||
# @TEST-EXEC: btest-diff output
|
||||
# @TEST-EXEC: btest-diff redis.log
|
||||
|
||||
# Testing the example of pub sub in REDIS docs:
|
||||
# https://redis.io/docs/latest/develop/interact/pubsub/
|
||||
# These are just commands between two different clients, one PUBLISH and one SUBSCRIBE
|
||||
# Test pub/sub from Redis. This has two subscribers, one using a pattern. Then, the
|
||||
# messages that were published get printed to output.
|
||||
|
||||
@load base/protocols/redis
|
||||
|
||||
event Redis::server_push(c: connection, data: Redis::ReplyData)
|
||||
{
|
||||
print "Got published data!", data;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue