Updates to support the newer Squid rewrite syntax.
--- a/README Tue Jun 09 12:01:57 2015 -0700
+++ b/README Tue Jun 09 16:36:16 2015 -0700
@@ -51,8 +51,7 @@
if you find that to be more efficient for your environment. Adjust to
taste.
- url_rewrite_concurrency 60
- url_rewrite_children 5
+ url_rewrite_children 5 startup=1 idle=2 concurrency=50
Using volta
--- a/examples/lua-example.lua Tue Jun 09 12:01:57 2015 -0700
+++ b/examples/lua-example.lua Tue Jun 09 16:36:16 2015 -0700
@@ -13,6 +13,6 @@
-- how easy it is to do custom stuff.
--
if os.time() % 2 == 0 then
- return string.format( "%d:http://example.com%s", redir, request.path )
+ return string.format( "OK status=%d url=http://example.com%s", redir, request.path )
end
--- a/examples/rules.txt Tue Jun 09 12:01:57 2015 -0700
+++ b/examples/rules.txt Tue Jun 09 16:36:16 2015 -0700
@@ -10,7 +10,7 @@
google.com * 302:https://www.google.com
# Transparently alter all uploaded images on imgur to be my face: :)
-i.imgur.com \.(gif|png|jpg)$ http://www.martini.nu/images/mahlon.jpg
+i.imgur.com \.(gif|png|jpg)$ http://www.martini.nu/img/mahlon.jpg
# Expand a local, non qualified hostname to a FQDN (useful alongside the
# 'dns_defnames' squid setting to enforce browser proxy behaviors):
--- a/parser.rl Tue Jun 09 12:01:57 2015 -0700
+++ b/parser.rl Tue Jun 09 16:36:16 2015 -0700
@@ -1,6 +1,6 @@
/* vim: set noet nosta sw=4 ts=4 ft=ragel : */
/*
-Copyright (c) 2011, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
--- a/process.c Tue Jun 09 12:01:57 2015 -0700
+++ b/process.c Tue Jun 09 16:36:16 2015 -0700
@@ -132,8 +132,8 @@
return;
}
- if ( request && request->chid ) printf( "%s", request->chid );
- printf( "\n" );
+ if ( request && request->chid ) printf( "%s ", request->chid );
+ printf( "ERR\n" );
fflush( stdout );
finish_parsed( rule );
@@ -152,7 +152,18 @@
if ( rule == NULL || v.debugmode >= 5 ) return;
if ( request->chid ) printf( "%s", request->chid );
- if ( rule->redir ) printf( "%s:", rule->redir );
+ printf( "OK " );
+
+ /* Redirect */
+ if ( rule->redir ) {
+ printf( "status=%s url=", rule->redir );
+ }
+
+ /* Rewrite */
+ else {
+ printf( "rewrite-url=" );
+ }
+
printf( "%s%s", (rule->scheme ? rule->scheme : request->scheme), rule->host );
if ( rule->port ) printf( ":%s", rule->port );
printf( "%s", rule->path ? rule->path : request->path );
--- a/volta.h Tue Jun 09 12:01:57 2015 -0700
+++ b/volta.h Tue Jun 09 16:36:16 2015 -0700
@@ -58,7 +58,7 @@
*/
#ifdef DEBUG
-#include <google/profiler.h>
+#include <gperftools/profiler.h>
#endif
/* Default line size we accept from squid, longer lines (huge URLs?) malloc. */