This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis; | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
} | |
backend self { | |
.host = "127.0.0.1"; | |
.port = "80"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis; | |
sub vcl_recv { | |
if (req.url ~ "^/[lL]/[A-Za-z0-9\-_]{4,32}=?=?$") { | |
set req.http.New-Location = redis.call(regsub(req.url, "^/[lL]/([A-Za-z0-9\-_]{2})([A-Za-z0-9\-_]{2,30}=?=?)$", "HGET short:\1 \2")); | |
if (req.http.New-Location) { | |
error 666; | |
} | |
error 404 "Not Found"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/vmod_redis.c b/src/vmod_redis.c | |
index b59652b..7c0544e 100644 | |
--- a/src/vmod_redis.c | |
+++ b/src/vmod_redis.c | |
@@ -81,6 +81,18 @@ redis_common(struct sess *sp, struct vmod_priv *priv, const char *command) | |
} | |
reply = redisCommand(c, command); | |
+ if (c->err == REDIS_ERR_EOF) { | |
+ // It seems Redis has disconnected the client, let's try to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C{ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <hiredis/hiredis.h> | |
}C | |
sub vcl_recv { | |
if (req.http.host ~ "(?i)^a.luit.it$") { | |
if (req.url ~ "(?i)^/l/.*[A-Za-z0-9\-_]{4,}\+?$") { |
NewerOlder