Code Monkey home page Code Monkey logo

nginx-eval-module's People

Contributors

irvis avatar vkholodkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx-eval-module's Issues

Does not compile with gcc 4.6.2

Hi, Valery

I've tried to compile other nginx versions (1.0.11 - 1.1.15) on server with gcc 4.6.2 with last (125fa2e) version of that module and it was failed with such errors:

../nginx-eval-module/ngx_http_eval_module.c: In function ‘ngx_http_eval_block’:
../nginx-eval-module/ngx_http_eval_module.c:640:39: error: variable ‘pclcf’ set but not used [-Werror=unused-but-set-variable]
../nginx-eval-module/ngx_http_eval_module.c:631:32: error: variable ‘ecf’ set but not used [-Werror=unused-but-set-variable]
The problem is - new gcc becomes smarter and for now unused variables throws warnings. Nginx default config is:
-Werror=unused-but-set-variable]
BTW, with gcc 4.5.2 all was compiled successfully.
So, it would be great to fix module instead of changing nginx default options.

Thank you!
Vadim.

nginx-eval-module 1.0.3 $uri

Прописал
set $memcached_key "$request_uri";

Проверил, плеер передаёт кучу параметров.
/img_v/mp4-public/uuu_d2257c3c21eab413fdf7c4891bb1a3a9_00068006.flv?start=0&id=mediaplayer&client=FLASH%2520WIN%252010,1,85,3&version=4.3.132&width=400

а мне нужен только /img_v/mp4-public/uuu_d2257c3c21eab413fdf7c4891bb1a3a9_00068006.flv
в качестве ключа, в каком месте модуля нужно пофиксить? Я могу руками под себя править при каждой новой версии модуля :(
Не думаю что init согласится.

nginx 1.4.7 hangs on requests with eval

Nginx is compiled only with this module.
I've downloaded module from:
http://www.grid.net.ru/nginx/download/nginx_eval_module-1.0.1.tar.gz
And it hangs on request.

worker_processes  1;
error_log  logs/error.log  info;

events {
    use epoll;
    worker_connections 1024;
    multi_accept on;
}

http {
    include       mime.types;
    default_type  text/plain;
    sendfile        on;
    keepalive_timeout  5;

    server {
        listen 80;
        server_name test.local;

        location / {

            eval $res {
                proxy_set_header Host $http_host;
                proxy_pass http://127.0.0.1:8081/check;
            }

            if ($res = 'spam') {
                return 401;
            }
            if ($res != 'spam') {
                return 404;
            }
        }

    }

}

I can see communication with my upstream server:

127.000.000.001.42387-127.000.000.001.08081: GET /check HTTP/1.0
Host: test.local
Connection: close
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pl,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Cache-Control: max-age=0


127.000.000.001.08081-127.000.000.001.42387: HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: 11
Date: Sun, 30 Mar 2014 11:37:29 GMT
Connection: close

exampletext

Request and response are OK but after that nothing happend. Request hangs...

From port 80 perspective I have:

010.000.002.002.54814-010.000.002.015.00080: GET / HTTP/1.1
Host: test.local
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pl,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

And after couple of seconds connection is closed.

Help me. Thanks!

Segmentation fault when using eval module

segfault
I am using this eval module to capture response from google recaptcha service. But whenever I am trying to reload nginx, it keeps showing segmentation fault. I think the issue is that the variable initialized with eval module is storing null value, that's why it is showing segmentation fault. Can you suggest any corrections, or workaround if possible?

SPDY causes Error 324

I was excited to learn recently that SPDY is now supported by Nginx 1.3.x. It is a new type of networking protocol developed at Google that can reportedly speed up HTTPS page loading by as much as 39% - 55%. Unfortunately, as soon as I tried it on my site, which uses the Eval module for retrieving data from Memcached, I began getting the following error message when accessing a page with HTTPS:

Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.

This is the message that occurs in the Google Chrome browser but all browsers fail to load the page since no page body is sent in the response from nginx.

When disabling "spdy" in my config, or when commenting out my "eval" block, my site began to work normally again. I am not sure if it is even possible to get both of these working together, but it would be great to know if this is possible to fix. I love your module!

The instructions for installing SPDY with NGINX are found here:
http://nginx.org/patches/spdy/README.txt

My problematic eval block is only two lines, just like in the example:

eval $var {
set $memcached_key $1;
memcached_pass 192.168.2.1;
}

Unable to install it.

For some reason I am unable to install it on my server. When I do make I get these errors:

/root/src/nginx_eval_module-1.0.1/ngx_http_eval_module.c: In function ‘ngx_http_eval_block’:
/root/src/nginx_eval_module-1.0.1/ngx_http_eval_module.c:531:39: error: variable ‘pclcf’ set but not used [-Werror=unused-but-set-variable]
/root/src/nginx_eval_module-1.0.1/ngx_http_eval_module.c:522:32: error: variable ‘ecf’ set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/nginx_eval_module-1.0.1/ngx_http_eval_module.o] Error 1
make[1]: Leaving directory `/root/src/nginx-1.2.7'
make: *** [build] Error 2

Use eval with redis2?

I am trying to use eval with the redis2 nginx plugin. I want to get the backend server name from redis.

I am trying with this:

location / {

eval_escalate on;

eval $answer {
redis2_raw_query 'get server_name\r\n';
eval_override_content_type text/plain;

redis2_query get server_name;

redis2_pass 127.0.0.1:6379;
}
proxy_pass $answer;

But that doesn't work because the redis response has the string length at the beginning of the response. So you get:

2010/12/28 17:05:34 [error] 52979#0: *73 invalid URL prefix in "$24
http://127.0.0.1/foo//" while sending to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"

Any ideas?

nginx 1.0.6 hangs on requests with eval

My config. Nginx is compiled only with this module. And it hangs on request.

events {
use epoll;
worker_connections 20480;
multi_accept on;
}

http{
server {
listen 80;
location / {

            eval $var {
                    proxy_pass http://77.88.21.3:80/$request_uri;
            }
    }

}

}

Can you add the support the of two eval module in two different location for the same request?

I have this need:
1, A request is sent to backend server with eval module.
2, If the eval response is '0', I want to rewrite this request to a second location.
3, In the second location, I also have a eval module. But It seem that the eval does not work in this location.

I changed the source a little, It seems works for me:
diff --git a/ngx_http_eval_module.c b/ngx_http_eval_module.c
index 402bbb6..fb7eaab 100644
--- a/ngx_http_eval_module.c
+++ b/ngx_http_eval_module.c
@@ -180,6 +180,16 @@ ngx_http_eval_handler(ngx_http_request_t *r)
ngx_http_set_ctx(r, ctx, ngx_http_eval_module);
}

  • if (ecf != ctx->base_conf) {
  •       ctx->in_progress = 0;
    
  •       ctx->done = 0;
    
  •       ctx->base_conf = ecf;
    
  •       ctx->current_block = ecf->blocks->elts;
    
  •       ctx->last_block = ctx->current_block + ecf->blocks->nelts - 1;
    
  • }

if(ctx->done) {
ctx->in_progress = 0;

Does not compile with gcc 4.6.2

Hi, Valery

I've tried to compile other nginx versions (1.0.11 - 1.1.15) on server with gcc 4.6.2 with last (125fa2e) version of that module and it was failed with such errors:

../nginx-eval-module/ngx_http_eval_module.c: In function ‘ngx_http_eval_block’:
../nginx-eval-module/ngx_http_eval_module.c:640:39: error: variable ‘pclcf’ set but not used [-Werror=unused-but-set-variable]
../nginx-eval-module/ngx_http_eval_module.c:631:32: error: variable ‘ecf’ set but not used [-Werror=unused-but-set-variable]
The problem is - new gcc becomes smarter and for now unused variables throws warnings. Nginx default config is:
-Werror=unused-but-set-variable]
So, it would be great to fix module instead of changing nginx default options.

Thank you!
Vadim.

Unable to use as dynamic module

It works if built statically (though with bugs, can't read body sent by eval module via proxy_pass). But refuses to load as a dynamic module. This is a backtrace:

GNU gdb (GDB) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-alpine-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from nginx...
(No debugging symbols found in nginx)
[New LWP 16]
Core was generated by `nginx -t'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  ngx_http_eval_merge_loc_conf (cf=0x7ffc2dec70c8, parent=0x7fc63fbcd298, child=0x0) at //nginx-eval-module-1.0.4/ngx_http_eval_module.c:525
525	//nginx-eval-module-1.0.4/ngx_http_eval_module.c: No such file or directory.

I build modules, configuring nginx sources like this:

./configure --add-dynamic-module=$NGINX_EVAL_DIR --with-compat $CONFARGS

where CONFARGS - are configure arguments for Nginx in the container.

Then I copy .so to another exactly the same container as nginx module (to /etc/nginx/modules/) without build requirements installed (nginxes are the same with the same CONFARGS).

For example headers-more-nginx-module built in the same way loads well.

Error building nginx with --add-module=nginx-eval-module

This is error:

/home/mimiko/src/nginx-modules/nginx-eval-module/ngx_http_eval_module.c
/home/mimiko/src/nginx-modules/nginx-eval-module/ngx_http_eval_module.c: In function Б-?ngx_http_eval_blockБ-?:
/home/mimiko/src/nginx-modules/nginx-eval-module/ngx_http_eval_module.c:640:39: error: variable Б-?pclcfБ-? set but not used [-Werror=unused-but-set-variable]
/home/mimiko/src/nginx-modules/nginx-eval-module/ngx_http_eval_module.c:631:32: error: variable Б-?ecfБ-? set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/nginx-eval-module/ngx_http_eval_module.o] Error 1
make[1]: Leaving directory `/home/mimiko/src/nginx'
make: *** [build] Error 2

nginx-eval-module 1.0.3

http://github.com/vkholodkov/nginx-eval-module/blob/master/ngx_http_eval_module.c
Тестировал с nginx-0.7.67 и nginx-0.8.53
1.0.1 с to_uri.patch работает в nginx-0.7.67 а в старших 0.8.* нет

        eval_escalate on;
        eval $path {
           set $memcached_key   "$uri";
           memcached_pass  10.0.0.3:11211;
        }
        root /farm-a-02;
        try_files /$path @blah;

В memcached он запрашивает /eval_*****

<30 new auto-negotiating client connection
30: Client using the ascii protocol
<30 get /eval_256556512

30 END
<30 connection closed.

error.log

http uri: "/img_v/mp4-public/uuu_d2257c3c21eab413fdf7c4891bb1a3a9_00068006.flv"
http subrequest "/eval_527896408?"
http posted request: "/eval_527896408?"
http script complex value
http script var: "/eval_527896408"
http script set $memcached_key
key: "/eval_527896408" was not found by memcached while reading response header from upstream

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.