Lua nginx compiled for nginx windows

2,386 views
Skip to first unread message

in...@ecsystems.nl

unread,
Sep 20, 2013, 2:53:00 PM9/20/13
to openre...@googlegroups.com
Hello, I am trying to get Lua to compile into nginx (1.4.2 or 1.5.5) but getting compiler directives errors (because of invalid switches) and missing includes (because winsock works differently), how ever I can get Luajit 202 compiled without problems, if patching sources is going to be too much work what about using the build objects code from luajit into the linking process of nginx? would this work? can anyone shed any light on what the actual problems are so we can work out the best way to get this working? another example could be to gateway OS calls via the luajit dll library. Maybe agentzh (as suggested by email) can give any hints?

in...@ecsystems.nl

unread,
Sep 21, 2013, 3:50:36 PM9/21/13
to openre...@googlegroups.com
Getting a bit further, got a working config file to get configure working but running into this issue:

With these in ndk.c:
#include    <ndk.h>
#include    <ndk_config.c>

I get;
objs/lib/ngx_devel_kit/src/ndk.c(8) : error C2220: warning treated as error - no 'object' file generated
objs/lib/ngx_devel_kit/src/ndk.c(8) : warning C4627: '#include <ndk.h>': skipped
 when looking for precompiled header use

Without the includes I get;
objs/lib/ngx_devel_kit/src/ndk.c(157) : fatal error C1010: unexpected end of file
while looking for precompiled header. Did you forget to add '#include "ngx_config.h"' to your source?

Anyone any ideas?

Yichun Zhang (agentzh)

unread,
Sep 21, 2013, 4:02:28 PM9/21/13
to openresty-en
Hello!

On Sat, Sep 21, 2013 at 12:50 PM, info wrote:
> I get;
> objs/lib/ngx_devel_kit/src/ndk.c(8) : error C2220: warning treated as error
> - no 'object' file generated
> objs/lib/ngx_devel_kit/src/ndk.c(8) : warning C4627: '#include <ndk.h>':
> skipped
> when looking for precompiled header use
>

Well, I know this one. Just disable the precompiling C header
mechanism in Nginx's build system. It sucks in that it does not
support header files in 3rd-party modules.

Regards,
-agentzh

in...@ecsystems.nl

unread,
Sep 21, 2013, 5:14:38 PM9/21/13
to openre...@googlegroups.com
Any hint where to turn this off? there are no /Fp compiler (cl) settings in use.

in...@ecsystems.nl

unread,
Sep 21, 2013, 5:50:21 PM9/21/13
to openre...@googlegroups.com
Got it, adjust Nginx Makefile and add /Y- to CFLAGS
On to the porting problems....

in...@ecsystems.nl

unread,
Sep 21, 2013, 5:59:55 PM9/21/13
to openre...@googlegroups.com
@agentzh: do you know if ngx_devel_kit is actually required for lua? or is it used as 'glue' between lua and nginx?

Yichun Zhang (agentzh)

unread,
Sep 21, 2013, 9:36:09 PM9/21/13
to openresty-en
Hello!

On Sat, Sep 21, 2013 at 2:59 PM, info wrote:
> @agentzh: do you know if ngx_devel_kit is actually required for lua? or is
> it used as 'glue' between lua and nginx?
>

ngx_devel_kit is an optional dependency for ngx_lua. It is required if
you want to use the set_by_lua and set_by_lua_file directives in
ngx_lua, or the ndk.set_var.DIRECTIVE Lua API. Otherwise it's fine to
leave it uninstalled.

Regards,
-agentzh

in...@ecsystems.nl

unread,
Sep 22, 2013, 9:19:33 AM9/22/13
to openre...@googlegroups.com
> ngx_devel_kit is an optional dependency for ngx_lua. It is required if

Ok, tackled ngx_devel_kit with mods from the windows resty kit, compiling now, but having other issues with lua_nginx like;

ngx_http_lua_module.c : warning C4152: nonstandard extension, function/data pointer conversion in expression
ngx_http_lua_util.c : warning C4244: '+=' : conversion from 'off_t' to 'size_t', possible loss of data
ngx_http_lua_socket_tcp.c : error C2039: 'single_connection' : is not a member of 'ngx_connection_s'

in...@ecsystems.nl

unread,
Sep 22, 2013, 3:29:42 PM9/22/13
to openre...@googlegroups.com
And the crowd goes wild ;-) It compiles!

Still getting alot of warnings about;
- nonstandard extension, function/data pointer conversion in expression
- conversion from 'off_t' to 'size_t', possible loss of data

Will have to test to see if these warnings have any effect on the general operation.

At least here's one patched routine;
/lua-nginx-module/src/ngx_http_lua_log.c (error C2143)

int
ngx_http_lua_ngx_log(lua_State *L)
{
    ngx_log_t                   *log;
    ngx_http_request_t          *r;
    const char                  *msg;
    int level;

    r = ngx_http_lua_get_req(L);

    if (r && r->connection && r->connection->log) {
        log = r->connection->log;

    } else {
        log = ngx_cycle->log;
    }

    level = luaL_checkint(L, 1);
    if (level < NGX_LOG_STDERR || level > NGX_LOG_DEBUG) {
        msg = lua_pushfstring(L, "bad log level: %d", level);
        return luaL_argerror(L, 1, msg);
    }

    /* remove log-level param from stack */
    lua_remove(L, 1);

    return log_wrapper(log, "[lua] ", (ngx_uint_t) level, L);
}

Yichun Zhang (agentzh)

unread,
Sep 22, 2013, 4:36:34 PM9/22/13
to openresty-en
Hello!
It seems that you're using an old version of ngx_lua. Which version of
ngx_lua are you using? The "single_connection" thing was removed
already.

Also, it'll be great if you provide source line numbers in these C
compiler warnings or errors.

Regards,
-agentzh

in...@ecsystems.nl

unread,
Sep 22, 2013, 4:48:28 PM9/22/13
to openre...@googlegroups.com
> It seems that you're using an old version of ngx_lua. Which version of
> ngx_lua are you using? The "single_connection" thing was removed

Yes sorry abt that, I was testing different versions for compiler/makefile debugging. I've got 2.02 working.


> Also, it'll be great if you provide source line numbers in these C compiler warnings or errors.

I will some time tomorrow, just shut down the development machine, spend enough hours to get it compiling.

Yichun Zhang (agentzh)

unread,
Sep 22, 2013, 4:52:32 PM9/22/13
to openresty-en
Hello!

On Sun, Sep 22, 2013 at 1:48 PM, info wrote:
>> It seems that you're using an old version of ngx_lua. Which version of
>> ngx_lua are you using? The "single_connection" thing was removed
>
> Yes sorry abt that, I was testing different versions for compiler/makefile
> debugging. I've got 2.02 working.
>

What is the magic number 2.02 here? It does not look like a version
number for ngx_lua nor ngx_openresty. The latest ngx_lua version is
0.8.9, as you can see from here:

http://wiki.nginx.org/HttpLuaModule#Version

>> Also, it'll be great if you provide source line numbers in these C compiler warnings or errors.
>>
> I will some time tomorrow, just shut down the development machine, spend
> enough hours to get it compiling.
>

Great :) It's appreciated :)

Regards,
-agentzh

Yichun Zhang (agentzh)

unread,
Sep 22, 2013, 5:25:52 PM9/22/13
to openresty-en
Hello!

On Sun, Sep 22, 2013 at 12:29 PM, info wrote:
> And the crowd goes wild ;-) It compiles!
>

Does it run?

> Still getting alot of warnings about;
>
> - nonstandard extension, function/data pointer conversion in expression
> - conversion from 'off_t' to 'size_t', possible loss of data
>

I'd love to see the detailed compiler error and warning messages :)

> Will have to test to see if these warnings have any effect on the general
> operation.
>

Unlikely though. But I'd still want to fix them :)

> At least here's one patched routine;
> /lua-nginx-module/src/ngx_http_lua_log.c (error C2143)
>
> int
> ngx_http_lua_ngx_log(lua_State *L)
> {
> ngx_log_t *log;
> ngx_http_request_t *r;
> const char *msg;
> int level;
>
[...]
>
> level = luaL_checkint(L, 1);

Nice catch. We did not define the local variable "level" at the
beginning of the code block. Already fixed in git master:

https://github.com/chaoslawful/lua-nginx-module/commit/1d4c76d

Thanks!
-agentzh

in...@ecsystems.nl

unread,
Sep 23, 2013, 5:41:39 AM9/23/13
to openre...@googlegroups.com

> Does it run?

Yes!
I need a bit more complex test code to test but this one works:

        location /robots.txt {
          rewrite_by_lua '
            if ngx.var.http_host ~= "localhost" then
              return ngx.exec("/robots_disallow.txt");
            end
          ';

        }
 
> I'd love to see the detailed compiler error and warning messages :)
 
I'll include the findings but don't shoot the messenger :) remember YOU asked for it :-))
nb. I'll email the zipfile as google is giving me errors when attaching a file...

As to your previous question abt which Lua version...
 
nginx 1.5.6 (22-9-2013) with;
+ lua-nginx-module v0.8.9
+ LuaJIT-2.0.2 (lua51.dll include / lua51.lib build)
+ ngx_devel_kit v0.2.15

in...@ecsystems.nl

unread,
Sep 23, 2013, 8:41:26 AM9/23/13
to openre...@googlegroups.com
@agentzh, A good lua test would be (as this is one of my interests in lua) an easy way to block sql attacks, ea. http://www.cvedetails.com/cve/CVE-2013-5723/
Would you be willing to share some of your cloudflare WAF lua code to get some basic WAF running in nginx/lua?

Joseph Mutumi

unread,
Sep 23, 2013, 11:50:40 AM9/23/13
to openre...@googlegroups.com
Hello,

Actually managed to compile it too sometime back. Had to patch some files but it works! I didn't document it but was using Mingw with gcc version 4.6.2 (GCC). Just as a few tips:

1. Make sure you can compile nginx and lua (or luajit) separately first.
2. For some reason nginx didn't compile with some modules like gzip or ssl :(
3. nginx on windows must be compiled with select that's the default for windows

Hope this is useful info. If you are interested I could try to come up with the steps I used.

Cheers.


On Mon, Sep 23, 2013 at 3:41 PM, <in...@ecsystems.nl> wrote:
@agentzh, A good lua test would be (as this is one of my interests in lua) an easy way to block sql attacks, ea. http://www.cvedetails.com/cve/CVE-2013-5723/
Would you be willing to share some of your cloudflare WAF lua code to get some basic WAF running in nginx/lua?

--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Joseph N. Mutumi

Chief Technical Office
Victorium Holdings

victorium.biz  |  Facebook  |  Twitter  |  Blog

in...@ecsystems.nl

unread,
Sep 23, 2013, 1:46:26 PM9/23/13
to openre...@googlegroups.com
10:37 23-9-2013: nginx 1.5.6.1 Alice

Based on nginx 1.5.6 (22-9-2013) with;
+ Streaming with nginx-rtmp-module, v1.0.4 (http://nginx-rtmp.blogspot.nl/)
+ lua-nginx-module v0.8.9 (tnx to agentzh about precompiled headers!)
+ LuaJIT-2.0.2 => (lua51.dll include / lua51.lib build)
+ Added lua51.dll (is required)
+ ngx_devel_kit v0.2.15
* Additional specifications are like 10:27 10-9-2013: B02 build

Builds can be found here:
  http://nginx-win.ecsds.eu/


Build process and changes are documented, when all major issues have been resolved they will be made public.

Yichun Zhang (agentzh)

unread,
Sep 23, 2013, 2:07:19 PM9/23/13
to openresty-en
Hello!

On Mon, Sep 23, 2013 at 5:41 AM, <in...@ecsystems.nl> wrote:
> @agentzh, A good lua test would be (as this is one of my interests in lua)
> an easy way to block sql attacks, ea.
> http://www.cvedetails.com/cve/CVE-2013-5723/

Yeah, you can do that yourself :)

> Would you be willing to share some of your cloudflare WAF lua code to get
> some basic WAF running in nginx/lua?
>

It's a big code base. Our WAF engineers built a mod_security port for
ngx_lua. And CloudFlare does not opensource it yet.

Regards,
-agentzh

Yichun Zhang (agentzh)

unread,
Sep 24, 2013, 1:36:59 AM9/24/13
to openresty-en
Hello!

On Sun, Sep 22, 2013 at 1:48 PM, <in...@ecsystems.nl> wrote:
>> Also, it'll be great if you provide source line numbers in these C
>> compiler warnings or errors.
>
> I will some time tomorrow, just shut down the development machine, spend
> enough hours to get it compiling.
>

I've looked into the raw mingw compiler warnings you sent me off the
list. I've fixed most of the warnings in ngx_lua and ngx_devel_kit's
git masters:

https://github.com/chaoslawful/lua-nginx-module/commit/585e7af
https://github.com/simpl/ngx_devel_kit/commit/4944025

Please try out these two project's git master again on your side :)

One that in ngx_lua that has not yet been fixed for the Windows build
is an issue in the Lua/LuaJIT bytecode file loader for Windows. I've
filed a github issue for this:

https://github.com/chaoslawful/lua-nginx-module/issues/283

Before fixing this ticket, the Lua/LuaJIT bytecode file loader in
ngx_lua does not work on Windows even that part of code is also
compiled. Fortunately people don't use this feature much and this
feature is not mandatory. See the "Lua/LuaJIT bytecode support"
section in ngx_lua's documentation for more details on this feature:
http://wiki.nginx.org/HttpLuaModule#Lua.2FLuaJIT_bytecode_support

The remaining warnings regarding ngx_hash overflow look like false
positives, for example,

lua-nginx-module/src/ngx_http_lua_subrequest.c(1159) : warning
C4307: '*' : integral constant overflow
lua-nginx-module/src/ngx_http_lua_control.c(258) : warning C4307:
'*' : integral constant overflow

I'm not sure how to fix these warnings (yet).

BTW, you can paste long text to the github gist site, for example:

https://gist.github.com/

or pastebin:

http://pastebin.com/

And just put the resulting link in your email.

Looks like I need to run a Windows box to test my code sometime in the future :)

Best regards,
-agentzh

in...@ecsystems.nl

unread,
Sep 24, 2013, 6:48:01 AM9/24/13
to openre...@googlegroups.com
>> an easy way to block sql attacks, ea.
>Yeah, you can do that yourself :)

But it would be easier with an example from you :)


>Looks like I need to run a Windows box to test my code sometime in the future :)

Get yourself virtualbox, surely you got some w7 license laying about doing nothing :)


>Please try out these two project's git master again on your side :)

Done, here are the patches and other findings, its not too big to fit here;


lua-nginx-module/src/ngx_http_lua_control.c(258) : warning C4307: '*' : integral constant overflow
see also http://msdn.microsoft.com/en-us/library/4kze989h.aspx
ngx_http_lua_control.c
line 257:
            ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(
                     ngx_hash('l', 'o'), 'c'), 'a'), 't'), 'i'), 'o'), 'n');
*I count 7x ngx_hash but 8 hash values.
==============================================================================

lua-nginx-module/src/ngx_http_lua_subrequest.c(1159) : warning C4307: '*' : integral constant overflow
see also http://msdn.microsoft.com/en-us/library/4kze989h.aspx
ngx_http_lua_subrequest.c
line 1156:
    h->hash = ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(
            ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(
            ngx_hash('c', 'o'), 'n'), 't'), 'e'), 'n'), 't'), '-'), 'l'), 'e'),
            'n'), 'g'), 't'), 'h');
*I count 13x ngx_hash but 14 hash values.
==============================================================================
\ngx_devel_kit\src\ndk_log.h(162) :fatal error C1021: invalid preprocessor command 'warning'
-162
#warning "Nginx Devel Kit logging without variadic macros not yet implemented"
+162
/* #warning "Nginx Devel Kit logging without variadic macros not yet implemented" */
==============================================================================
/lua-nginx-module/src/ngx_http_lua_shdict.c(972) : error C2065: 'ushort' : undeclared identifier
/lua-nginx-module/src/ngx_http_lua_shdict.c(972) : error C2146: syntax error : missing ';' before identifier 'key'
/lua-nginx-module/src/ngx_http_lua_shdict.c(1079) : error C2065: 'ushort' : undeclared identifier
/lua-nginx-module/src/ngx_http_lua_shdict.c(1079) : error C2146: syntax error : missing ';' before identifier 'key'
-972
            sd->key_len = (ushort) key.len;
+972
            sd->key_len = (u_short) key.len;
-1079
    sd->key_len = (ushort) key.len;
+1079
    sd->key_len = (u_short) key.len;
==============================================================================

==============================================================================
/lua-nginx-module/src/ngx_http_lua_output.c(395) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
==============================================================================
objs/lib/lua-nginx-module/src/ngx_http_lua_headers_out.c(147) : warning C4307: '*' : integral constant overflow
objs/lib/lua-nginx-module/src/ngx_http_lua_headers_out.c(147) : warning C4307: '*' : integral constant overflow
objs/lib/lua-nginx-module/src/ngx_http_lua_headers_out.c(538) : warning C4307: '*' : integral constant overflow
objs/lib/lua-nginx-module/src/ngx_http_lua_headers_out.c(538) : warning C4307: '*' : integral constant overflow
==============================================================================
objs/lib/lua-nginx-module/src/ngx_http_lua_clfactory.c(368) : warning C4022: 'GetFileInformationByHandle' : pointer mismatch for actual parameter 1
objs/lib/lua-nginx-module/src/ngx_http_lua_clfactory.c(368) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details.

Yichun Zhang (agentzh)

unread,
Sep 24, 2013, 5:30:45 PM9/24/13
to openresty-en
Hello!

On Tue, Sep 24, 2013 at 3:48 AM, <in...@ecsystems.nl> wrote:
>>Looks like I need to run a Windows box to test my code sometime in the
>> future :)
>
> Get yourself virtualbox, surely you got some w7 license laying about doing
> nothing :)
>

Yes, in a virtual machine. Possibly on Amazon EC2 though because I
don't want to buy Windows myself.

>>Please try out these two project's git master again on your side :)
>>
> Done, here are the patches and other findings, its not too big to fit here;

Thank you for trying it out again! I've submitted a patch to ngx_lua's
master that fixed most of these warnings:

https://github.com/chaoslawful/lua-nginx-module/commit/c6b6b31

and also committed a patch to ngx_devel_kit's master:

https://github.com/simpl/ngx_devel_kit/commit/4944025

> lua-nginx-module/src/ngx_http_lua_control.c(258) : warning C4307: '*' :
> integral constant overflow
> see also http://msdn.microsoft.com/en-us/library/4kze989h.aspx
> ngx_http_lua_control.c
> line 257:
> ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(
> ngx_hash('l', 'o'), 'c'), 'a'), 't'), 'i'), 'o'), 'n');
> *I count 7x ngx_hash but 8 hash values.
>

This is not the real issue. ngx_hash takes 2 arguments hence the difference.

>
> lua-nginx-module/src/ngx_http_lua_subrequest.c(1159) : warning C4307: '*' :
> integral constant overflow

Yeah, as the warning itself suggests, the real issue is 32-bit integer
overflow on 32-bit systems. The overflow itself is indeed the expected
behavior when calculating the string hash so all we need is to
suppress this warning.

Already fixed in my new patch.

> ngx_http_lua_subrequest.c: line 1156:
> h->hash =
> ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(
> ngx_hash(ngx_hash(ngx_hash(ngx_hash(ngx_hash(
> ngx_hash('c', 'o'), 'n'), 't'), 'e'), 'n'), 't'), '-'), 'l'),
> 'e'),
> 'n'), 'g'), 't'), 'h');

Already fixed in my patch.

> \ngx_devel_kit\src\ndk_log.h(162) :fatal error C1021: invalid preprocessor
> command 'warning'
> -162
> #warning "Nginx Devel Kit logging without variadic macros not yet
> implemented"
> +162
> /* #warning "Nginx Devel Kit logging without variadic macros not yet
> implemented" */
>

Already fixed in my patch.

> /lua-nginx-module/src/ngx_http_lua_shdict.c(972) : error C2065: 'ushort' :
> undeclared identifier
> /lua-nginx-module/src/ngx_http_lua_shdict.c(972) : error C2146: syntax error
> : missing ';' before identifier 'key'
> /lua-nginx-module/src/ngx_http_lua_shdict.c(1079) : error C2065: 'ushort' :
> undeclared identifier
> /lua-nginx-module/src/ngx_http_lua_shdict.c(1079) : error C2146: syntax
> error : missing ';' before identifier 'key'

Nice catch. Already fixed in my patch.

> /lua-nginx-module/src/ngx_http_lua_output.c(395) : warning C4244: '=' :
> conversion from 'double' to 'int', possible loss of data
>

Already fixed in my patch.

> objs/lib/lua-nginx-module/src/ngx_http_lua_headers_out.c(147) : warning
> C4307: '*' : integral constant overflow
> objs/lib/lua-nginx-module/src/ngx_http_lua_headers_out.c(147) : warning
> C4307: '*' : integral constant overflow
> objs/lib/lua-nginx-module/src/ngx_http_lua_headers_out.c(538) : warning
> C4307: '*' : integral constant overflow
> objs/lib/lua-nginx-module/src/ngx_http_lua_headers_out.c(538) : warning
> C4307: '*' : integral constant overflow
>

They should already be fixed in my patch.

> objs/lib/lua-nginx-module/src/ngx_http_lua_clfactory.c(368) : warning C4022:
> 'GetFileInformationByHandle' : pointer mismatch for actual parameter 1
> objs/lib/lua-nginx-module/src/ngx_http_lua_clfactory.c(368) : warning C4996:
> 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO
> C++ conformant name: _fileno. See online help for details.
>

These two are due to the pending compatibility issue in the Lua/LuaJIT
bytecode file loader in ngx_lua that I mentioned:

https://github.com/chaoslawful/lua-nginx-module/issues/283

I'm waiting for jinglong to see if he'd like to fix it.

Could you please try out the new masters of ngx_lua and ngx_devel_kit
again on your side?

Thanks!
-agentzh

in...@ecsystems.nl

unread,
Sep 25, 2013, 8:16:05 AM9/25/13
to openre...@googlegroups.com
>Could you please try out the new masters of ngx_lua and ngx_devel_kit again on your side?

Done!


\ngx_devel_kit\src\ndk_log.h(162) :fatal error C1021: invalid preprocessor command 'warning'
*Fix was not committed dd. 25-9, actual fix:
Line 162 (or implement #if (WIN32)):

/* #warning "Nginx Devel Kit logging without variadic macros not yet implemented" */

/lua-nginx-module/src/ngx_http_lua_clfactory.c(368) : warning C4022: 'GetFileInformationByHandle' : pointer mismatch for actual parameter 1
*Known warning.


/lua-nginx-module/src/ngx_http_lua_clfactory.c(368) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details.
*Renamed fileno to _fileno as suggested by compiler, warning gone.

Yichun Zhang (agentzh)

unread,
Sep 25, 2013, 3:32:27 PM9/25/13
to openresty-en
Hello!

On Wed, Sep 25, 2013 at 5:16 AM, <in...@ecsystems.nl> wrote:
>
> \ngx_devel_kit\src\ndk_log.h(162) :fatal error C1021: invalid preprocessor
> command 'warning'
> *Fix was not committed dd. 25-9, actual fix:
> Line 162 (or implement #if (WIN32)):
>

Oh sorry, my bad! I forgot to push my commit to ngx_devel_kit. Just pushed:

https://github.com/simpl/ngx_devel_kit/commit/8dd0df5

Please try the new master of ngx_devel_kit again :)

>
> /lua-nginx-module/src/ngx_http_lua_clfactory.c(368) : warning C4022:
> 'GetFileInformationByHandle' : pointer mismatch for actual parameter 1
> *Known warning.
> /lua-nginx-module/src/ngx_http_lua_clfactory.c(368) : warning C4996:
> 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO
> C++ conformant name: _fileno. See online help for details.

I've applied a modified version of jinglong's patch to ngx_lua's master:

https://github.com/chaoslawful/lua-nginx-module/commit/0387a89

which should fix these two warnings (and also the bytecode loader on
Windows). Please try it out on your side :)

Thanks!
-agentzh

in...@ecsystems.nl

unread,
Sep 26, 2013, 3:51:45 AM9/26/13
to openre...@googlegroups.com
Zero warning, zero errors !

About this Test Suite,
do you have precompiled windows perl(activestate) libraries for Test::Nginx? (not every perl source is properly windows tested)
are the nginx test modules windows tested? (they have to be or I'll be running into bugs that may originate from the module itself, the chicken-egg problem)
I don't use memcached but xcache (which is far faster/better for windows) is there a test for xcache?
Where is the master perl test script? (I can only see some bare-bone examples)

Yichun Zhang (agentzh)

unread,
Sep 26, 2013, 2:33:20 PM9/26/13
to openresty-en
Hello!

On Thu, Sep 26, 2013 at 12:51 AM, <in...@ecsystems.nl> wrote:
> Zero warning, zero errors !
>

Yay!

> About this Test Suite,
> do you have precompiled windows perl(activestate) libraries for Test::Nginx?

You can use ActivePerl's "cpan" command-line utility to install
Test::Nginx from CPAN, that is, running the following command:

cpan Test::Nginx

> (not every perl source is properly windows tested)

Because I used to do Perl development on Windows for quite a few
years, I can say that most of the CPAN modules are well tested on
Windows. Test::Nginx is one of those exceptions and as the author of
Test::Nginx, I'd love to hear what you get on Windows.

> are the nginx test modules windows tested? (they have to be or I'll be
> running into bugs that may originate from the module itself, the chicken-egg
> problem)

Again, if you run into test failures, I'd like to see those failures
and tell if it is a test driver issue or your own Windows build issue.
The test results are very detailed about failures so it's easy to
tell.

> I don't use memcached but xcache (which is far faster/better for windows) is
> there a test for xcache?

Your personal preference of caching solutions is irrelevant here.

Memcached is used by the ngx_lua test suite to test some aspects of
its features, especially the TCP cosocket API.

> Where is the master perl test script? (I can only see some bare-bone
> examples)
>

The ngx_lua test suite always resides in ngx_lua's code repository
since day #1. It's under the t/ directory. The test cases are
declarative and the test suite is data driven. The examples your see
*are* the test cases themselves. Just follow the documentation about
the test suite and run it! :) See

http://wiki.nginx.org/HttpLuaModule#Test_Suite

Best regards,
-agentzh

in...@ecsystems.nl

unread,
Sep 27, 2013, 7:38:41 AM9/27/13
to openre...@googlegroups.com
> The test cases are declarative and the test suite is data driven. The examples your see *are* the test cases themselves. Just follow the documentation > about the test suite and run it! :) See    http://wiki.nginx.org/HttpLuaModule#Test_Suite

Ok, I'll get to it next week, first the next step, the merge between Lua and naxsi, a Waf on steroids :)

in...@ecsystems.nl

unread,
Sep 30, 2013, 8:43:02 AM9/30/13
to openre...@googlegroups.com
> Zero warning, zero errors !
>

Yay!


While reading http://openresty.org/download/agentzh-nginx-tutorials-en.html I want to add array-var-nginx-module,

Got some more for you :)

/src/ngx_http_array_var_module.c(80) : warning C4152: nonstandard extension, function/data pointer conversion in expression
/src/ngx_http_array_var_module.c(89) : warning C4152: nonstandard extension, function/data pointer conversion in expression
/src/ngx_http_array_var_module.c(141) : warning C4152: nonstandard extension, function/data pointer conversion in expression
/src/ngx_http_array_var_module.c(258) : warning C4152: nonstandard extension, function/data pointer conversion in expression
/src/ngx_http_array_var_module.c(312) : warning C4152: nonstandard extension, function/data pointer conversion in expression
/src/ngx_http_array_var_module.c(371) : warning C4152: nonstandard extension, function/data pointer conversion in expression

\src\ngx_http_array_var_module.c(480) : warning C4706: assignment within conditional expression
\src\ngx_http_array_var_module.c(497) : warning C4701: potentially uninitialized local variable 'last' used

/src/ngx_http_array_var_util.c(73) : warning C4152: nonstandard extension, function/data pointer conversion in expression

Yichun Zhang (agentzh)

unread,
Sep 30, 2013, 10:45:43 PM9/30/13
to openresty-en
Hello!

On Mon, Sep 30, 2013 at 5:43 AM, <in...@ecsystems.nl> wrote:
>
> Got some more for you :)
>
> /src/ngx_http_array_var_module.c(80) : warning C4152: nonstandard extension,
> function/data pointer conversion in expression
[...]
> /src/ngx_http_array_var_util.c(73) : warning C4152: nonstandard extension,
> function/data pointer conversion in expression
>

Committed a patch to master to fix these warnings:

https://github.com/agentzh/array-var-nginx-module/commit/fbc32b4

Please try out the latest master of ngx_array_var :)

Thanks!
-agentzh

in...@ecsystems.nl

unread,
Oct 1, 2013, 5:41:03 AM10/1/13
to openre...@googlegroups.com
> Please try out the latest master of ngx_array_var :)

You missed one :)

\src\ngx_http_array_var_module.c(503) : warning C4701: potentially uninitialized local variable 'last' used

Last is not defined near line 421;

static ngx_int_t
ngx_http_array_var_split(ngx_http_request_t *r, ngx_str_t *res,
    ngx_http_variable_value_t *v, void *data)
{
    ngx_http_array_split_data_t             *conf = data;
    ngx_http_variable_value_t               *sep, *str;
    ngx_str_t                               *s;
    u_char                                  *pos, *end, *last;
    ssize_t                                  max, i, len = 4;
    ngx_array_t                             *array;

Yichun Zhang (agentzh)

unread,
Oct 1, 2013, 5:17:18 PM10/1/13
to openresty-en
Hello!

On Tue, Oct 1, 2013 at 2:41 AM, <in...@ecsystems.nl> wrote:
> You missed one :)
>
> \src\ngx_http_array_var_module.c(503) : warning C4701: potentially
> uninitialized local variable 'last' used
>

Fixed in master:

https://github.com/agentzh/array-var-nginx-module/commit/467674

Please try it again :)

Thanks!
-agentzh

in...@ecsystems.nl

unread,
Oct 2, 2013, 6:32:25 AM10/2/13
to openre...@googlegroups.com

> \src\ngx_http_array_var_module.c(503) : warning C4701: potentially
> uninitialized local variable 'last' used
>

Fixed in master:

    https://github.com/agentzh/array-var-nginx-module/commit/467674

Please try it again :)
 
High 5 ! :)
 

in...@ecsystems.nl

unread,
Dec 10, 2013, 1:45:13 PM12/10/13
to openre...@googlegroups.com


On Thursday, September 26, 2013 8:33:20 PM UTC+2, agentzh wrote:
since day #1. It's under the t/ directory. The test cases are
declarative and the test suite is data driven. The examples your see
*are* the test cases themselves. Just follow the documentation about
the test suite and run it! :) See

    http://wiki.nginx.org/HttpLuaModule#Test_Suite

Best regards,
-agentzh

Well I have tried to get it to compile, this is near impossible to get it working under Windows due to maaaannnnyyyy fatal errors and a lot of missing dependencies and also every config change assumes linux paths, so I wrote my own prove thing :) http://nginx-win.ecsds.eu/prove.zip feedback appreciated :)

I know you can't run windows stuff but maybe by just reading the files you could suggest which, jet missing, tests are the most important and no I'm not going to rewrite all of them, there's too many between all the modules.
 

Yichun Zhang (agentzh)

unread,
Dec 10, 2013, 1:52:55 PM12/10/13
to openresty-en
Hello!

On Tue, Dec 10, 2013 at 10:45 AM, <in...@ecsystems.nl> wrote:
>
> Well I have tried to get it to compile, this is near impossible to get it
> working under Windows due to maaaannnnyyyy fatal errors and a lot of missing
> dependencies and also every config change assumes linux paths, so I wrote my
> own prove thing :) http://nginx-win.ecsds.eu/prove.zip feedback appreciated
> :)

If you are using ActivePerl or Strawberry Perl on Windows, then you
can just use the "cpan" utility to install all the dependencies
automatically:

cpan Test::Nginx

Let me know if you have any particular dependency installation issues
here. I used to do a lot of Perl hacking on Windows (many years ago),
so I'd love to hear about them.

After installing everything here, you're still recommended to use the
github version of Test::Nginx because there have accumulated quite
some changes that have not yet been released to CPAN:

https://github.com/agentzh/test-nginx

>
> I know you can't run windows stuff but maybe by just reading the files you
> could suggest which, jet missing, tests are the most important and no I'm
> not going to rewrite all of them, there's too many between all the modules.
>

No, you surely don't want to rewrite the whole test suite, which is
HUGE. And it's just a matter of porting the test scaffold Test::Nginx
over to Windows.

Regards,
-agentzh

in...@ecsystems.nl

unread,
Dec 11, 2013, 4:43:19 AM12/11/13
to openre...@googlegroups.com
I've spend an entire week trying to get this POS to compile for windows and not even mentioning all the patchwork it needs to accommodate windows paths+config files+starting stopping nginx, after 4 hours writing my own prove, which can be used for anything (not just nginx but iis and apache as well), doesn't need perl only curl which is well maintained and in compiled format and does ssl as well, I'm sticking with this one. It works, can be easily changed, anyone can understand how it works and most of all it just runs and works on any windows version.


Op dinsdag 10 december 2013 19:52:55 UTC+1 schreef agentzh:

Yichun Zhang (agentzh)

unread,
Dec 11, 2013, 11:36:16 AM12/11/13
to openresty-en
Hello!

On Wed, Dec 11, 2013 at 1:43 AM, <in...@ecsystems.nl> wrote:
> after 4 hours writing my own
> prove, which can be used for anything (not just nginx but iis and apache as
> well), doesn't need perl only curl which is well maintained and in compiled
> format and does ssl as well,

The problem with curl or any other well behaved http clients in a test
scaffold is that it cannot behave like any bad clients (like those
never close the connection actively) and thus hide various kinds of
bugs on the server side. Also a lot of test cases for extreme
conditions require collaborations on the client side which is not easy
for real world http clients that are not designed for testing. These
are why I created my own http client implementation in
Test::Nginx::Socket.

And yeah, testing is hard :)

> I'm sticking with this one. It works, can be
> easily changed, anyone can understand how it works and most of all it just
> runs and works on any windows version.
>

With curl you'll never get the whole ngx_lua test suite pass unless
you patch curl heavily (to accommodate all the things mentioned
above).

Best regards,
-agentzh

Jaydeep Dave

unread,
Jan 17, 2014, 1:00:42 AM1/17/14
to openre...@googlegroups.com
Hey there,

Here is a new open source WAF (based on Nginx, Lua (openresty).  https://github.com/jaydipdave/quickdefencewaf

Go and get some hands on.

Jaydeep Dave

unread,
Jan 17, 2014, 1:01:32 AM1/17/14
to openre...@googlegroups.com
Hey there,

Here is a new open source WAF (based on Nginx, Lua (openresty).  https://github.com/jaydipdave/quickdefencewaf

Go and get some hands on.

Reply all
Reply to author
Forward
0 new messages