Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error trying to make with nginx 1.11.8 mainline #9

Open
ghost opened this issue Jan 1, 2017 · 5 comments
Open

error trying to make with nginx 1.11.8 mainline #9

ghost opened this issue Jan 1, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Jan 1, 2017

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

@ghost
Copy link
Author

ghost commented Jan 1, 2017

then i did make without socks-nginx-module module then it went fine.

thanks

@dannote
Copy link
Owner

dannote commented Jan 1, 2017

Wow, they did some breaking changes in the internal API again. I'm very busy right now and will fix it ASAP.

@RukaZhop
Copy link

RukaZhop commented Jul 9, 2017

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.

@df-cryptostorm
Copy link

RukaZhop's patch gets the module working on the latest stable version of nginx too (1.18.0 as of writing this).

@dannote
Copy link
Owner

dannote commented Apr 7, 2021

I'm working on a rewrite of this module (b16b6f2), 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants