socks-nginx-module
socks-nginx-module copied to clipboard
error trying to make with nginx 1.11.8 mainline
i am trying to build nginx 1.11.8 on cent os x64 with socks-nginx-module, i have tried building with 1.11.5 and it completes successfully, but with 1.11.8 i get
-o objs/addon/src/ngx_http_socks_upstream.o \
/home/deploy/socks-nginx-module/src/ngx_http_socks_upstream.c
/home/deploy/socks-nginx-module/src/ngx_http_socks_upstream.c: In function ‘ngx_http_socks_upstream_send_response’: /home/deploy/socks-nginx-module/src/ngx_http_socks_upstream.c:2755:45: error: ‘ngx_http_file_cache_t’ has no member named ‘temp_path’ if (r->cache && r->cache->file_cache->temp_path) { ^ /home/deploy/socks-nginx-module/src/ngx_http_socks_upstream.c:2756:54: error: ‘ngx_http_file_cache_t’ has no member named ‘temp_path’ p->temp_file->path = r->cache->file_cache->temp_path; ^ /home/deploy/socks-nginx-module/src/ngx_http_socks_upstream.c: In function ‘ngx_http_socks_upstream_add’: /home/deploy/socks-nginx-module/src/ngx_http_socks_upstream.c:4794:21: error: ‘ngx_http_upstream_srv_conf_t’ has no member named ‘default_port’ if (uscfp[i]->default_port && u->default_port ^ /home/deploy/socks-nginx-module/src/ngx_http_socks_upstream.c:4795:24: error: ‘ngx_http_upstream_srv_conf_t’ has no member named ‘default_port’ && uscfp[i]->default_port != u->default_port) ^ /home/deploy/socks-nginx-module/src/ngx_http_socks_upstream.c:4817:9: error: ‘ngx_http_upstream_srv_conf_t’ has no member named ‘default_port’ uscf->default_port = u->default_port; ^ make[1]: *** [objs/addon/src/ngx_http_socks_upstream.o] Error 1 make[1]: Leaving directory `/home/deploy/nginx-1.11.8' make: *** [build] Error 2
thanks
then i did make without socks-nginx-module module then it went fine.
thanks
Wow, they did some breaking changes in the internal API again. I'm very busy right now and will fix it ASAP.
Dannote leave his message half year ago and nothing changed. Apparently Danila still working hard at job)
So we have to do it yourself... ngx_http_socks_upstream.c based on ngx_http_proxy_module.c and we can compare 1.10.0 and 1.12.0 versions of this files. There is not so more changes and we just start looking only for fix errors and don't implementented all changes like 429 code etc. After few minutes of searching we can make ugly patch:
--- ./nginx-1.10.0/socks-nginx-module/src/ngx_http_socks_upstream.c 2017-01-04 21:43:41.000000000 +0300
+++ ./nginx-1.12.0/socks-nginx-module/src/ngx_http_socks_upstream.c 2017-07-08 22:14:33.961232070 +0300
@@ -2752,8 +2752,9 @@
p->temp_file->persistent = 1;
#if (NGX_HTTP_CACHE)
- if (r->cache && r->cache->file_cache->temp_path) {
- p->temp_file->path = r->cache->file_cache->temp_path;
+ if (r->cache && r->cache->file_cache->use_temp_path) {
+ p->temp_file->path = r->cache->file_cache->path;
+ p->temp_file->file.name = r->cache->file.name;
}
#endif
@@ -4791,14 +4792,9 @@
continue;
}
- if (uscfp[i]->default_port && u->default_port
- && uscfp[i]->default_port != u->default_port)
- {
- continue;
- }
-
if (flags & NGX_HTTP_UPSTREAM_CREATE) {
uscfp[i]->flags = flags;
+ uscfp[i]->port = 0;
}
return uscfp[i];
@@ -4814,7 +4810,6 @@
uscf->file_name = cf->conf_file->file.name.data;
uscf->line = cf->conf_file->line;
uscf->port = u->port;
- uscf->default_port = u->default_port;
uscf->no_port = u->no_port;
if (u->naddrs == 1 && (u->port || u->family == AF_UNIX)) {
P.S. I'm not a programmer. Applying and using this patch at your risk.
RukaZhop's patch gets the module working on the latest stable version of nginx too (1.18.0 as of writing this).
I'm working on a rewrite of this module (b16b6f2bcc65bb9a4ab7115c6554cd85b6ac8c2b), so it's unlikely that I would merge this patch. I'll keep this issue open so you can try it at your own risk.