Patch for ngx_purge_cache on nginx-1.3.2 not working

Ruslan Ermilov ru at nginx.com
Thu Jun 28 13:44:57 UTC 2012


On Thu, Jun 28, 2012 at 05:18:39AM +0800, MagicBear wrote:
> I am sorry, i make patch file opposite, this is the corrent version.
> 
> --- a/ngx_cache_purge_module.c  2012-06-28 05:08:44.000000000 +0800
> +++ b/ngx_cache_purge_module.c  2011-12-20 20:36:20.000000000 +0800
> @@ -41,7 +41,7 @@ char       *ngx_http_fastcgi_cache_purge
>  ngx_int_t   ngx_http_fastcgi_cache_purge_handler(ngx_http_request_t *r);
>  # endif /* NGX_HTTP_FASTCGI */
> 
> -# if (NGX_HTTP_PROXY)
> +# if (NGX_HTTP_PROXY || nginx_version >= 1003002)
>  char       *ngx_http_proxy_cache_purge_conf(ngx_conf_t *cf,
>                  ngx_command_t *cmd, void *conf);
>  ngx_int_t   ngx_http_proxy_cache_purge_handler(ngx_http_request_t *r);
> @@ -76,7 +76,7 @@ static ngx_command_t  ngx_http_cache_pur
>        NULL },
>  # endif /* NGX_HTTP_FASTCGI */
> 
> -# if (NGX_HTTP_PROXY)
> +# if (NGX_HTTP_PROXY || nginx_version >= 1003002)
>      { ngx_string("proxy_cache_purge"),
>        NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
>        ngx_http_proxy_cache_purge_conf,
> @@ -257,7 +257,7 @@ ngx_http_fastcgi_cache_purge_handler(ngx
>  }
>  # endif /* NGX_HTTP_FASTCGI */
> 
> -# if (NGX_HTTP_PROXY)
> +# if (NGX_HTTP_PROXY || nginx_version >= 1003002)
>  extern ngx_module_t  ngx_http_proxy_module;
> 
>  typedef struct {

This is a wrong patch.  As of 1.3.2, nginx no longer exposes the
NGX_HTTP_PROXY macro, and it never exposed any of the macros
NGX_HTTP_{FASTCGI,SCGI,UWSGI} that this module is trying to use
to detect if the modules were configured to be built.

The below patch should be better compatible with both old and
changed versions of nginx:

%%%
--- ngx_cache_purge-1.5/config	2011-12-20 16:36:20.000000000 +0400
+++ ngx_cache_purge-1.5/config	2012-06-28 17:33:42.000000000 +0400
@@ -1,3 +1,7 @@
+if [ "$HTTP_PROXY" = "YES" ]; then
+    have=NGX_HTTP_PROXY . auto/have
+fi
+
 if [ "$HTTP_FASTCGI" = "YES" ]; then
     have=NGX_HTTP_FASTCGI . auto/have
 fi
%%%



More information about the nginx-devel mailing list