"nginx -v" outputs is in stderr.

2016-02-17 Thread ZEUS-mgtGM KUJIRAI, Takahiro
Hello, Dounin!


>Yes, this is by design.
>See https://trac.nginx.org/nginx/ticket/592 for more details.

I understood.
And, I like stdout, I'll change source codes and use nginx.


Thanks.
Takahiro Kujirai
@Zeus-Enterprise.Co.Ltd

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: "nginx -v" outputs is in stderr.

2016-02-17 Thread Maxim Dounin
Hello!

On Wed, Feb 17, 2016 at 05:07:12PM +0900, Takahiro Kujirai wrote:

> This is Takahiro Kujirai.
> 
> When I typed "nginx -v > /tmp/nginx.txt"  on nginx 1.9.11, I found output
> is in stderr.

[...]

> I think "stdout" is good, not "stderr", is this the design?

Yes, this is by design.
See https://trac.nginx.org/nginx/ticket/592 for more details.

-- 
Maxim Dounin
http://nginx.org/

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: Slice module

2016-02-17 Thread Martijn Berkvens
Hi,

First off, thank you for the work on the slice module. We’re currently using a 
lua implementation to achieve something similar but this has its shortcomings 
and we would prefer to use this module. 

We’ve been testing this module and when using range requests it works as 
expected, but when doing normal requests (without a request range) the module 
still slices the content when the configured slice size is met resulting in 
corrupt data as it will only serve out the configured slice size and not the 
entire requested file.
We run into these issues because a server or location configuration within 
nginx would service both normal requests as range requests and we have files 
exceeding the slice size in both cases. 

Ideally the slice module would only do its magic when a request contains 
$http_range. We’ve tried creating a map which would set the slice size to 0 (to 
disable slicing) when no $http_range is present, but unfortunately the slice 
directive currently does not support variables. 

For our use case it would most likely be sufficient to add variable support to 
the slice directive. It is understood and acceptable that we would have 
duplicate cached content in cases where we have both the sliced versions of the 
file as the entire file. 


Thanks again!

Regards,
Martijn



___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

"nginx -v" outputs is in stderr.

2016-02-17 Thread Takahiro Kujirai
Hi all,

This is Takahiro Kujirai.

When I typed "nginx -v > /tmp/nginx.txt"  on nginx 1.9.11, I found output
is in stderr.
---

[root@localhost ~]# nginx -v > /tmp/nginx.txt
nginx version: nginx/1.9.11
[root@localhost ~]#
[root@localhost ~]# nginx -v 2> /tmp/nginx.txt
[root@localhost ~]# cat /tmp/nginx.txt
nginx version: nginx/1.9.11


I read source code(line374-434 of
https://github.com/nginx/nginx/blob/master/src/core/nginx.c),
I found using ngx_write_stderr.
---
static void
ngx_show_version_info()
{
ngx_write_stderr("nginx version: " NGINX_VER_BUILD NGX_LINEFEED);

if (ngx_show_help) {
ngx_write_stderr(
"Usage: nginx [-?hvVtTq] [-s signal] [-c filename] "
 "[-p prefix] [-g directives]" NGX_LINEFEED
 NGX_LINEFEED
"Options:" NGX_LINEFEED
"  -?,-h : this help" NGX_LINEFEED
"  -v: show version and exit" NGX_LINEFEED
"  -V: show version and configure options then
exit"
   NGX_LINEFEED
"  -t: test configuration and exit" NGX_LINEFEED
"  -T: test configuration, dump it and exit"
   NGX_LINEFEED
"  -q: suppress non-error messages "
   "during configuration testing" NGX_LINEFEED
"  -s signal : send signal to a master process: "
   "stop, quit, reopen, reload" NGX_LINEFEED
#ifdef NGX_PREFIX
"  -p prefix : set prefix path (default: " NGX_PREFIX ")"
   NGX_LINEFEED
#else
"  -p prefix : set prefix path (default: NONE)"
NGX_LINEFEED
#endif
"  -c filename   : set configuration file (default: "
NGX_CONF_PATH
   ")" NGX_LINEFEED
"  -g directives : set global directives out of configuration "
   "file" NGX_LINEFEED NGX_LINEFEED
);
}

if (ngx_show_configure) {

#ifdef NGX_COMPILER
ngx_write_stderr("built by " NGX_COMPILER NGX_LINEFEED);
#endif

#if (NGX_SSL)
if (SSLeay() == SSLEAY_VERSION_NUMBER) {
ngx_write_stderr("built with " OPENSSL_VERSION_TEXT
NGX_LINEFEED);
} else {
ngx_write_stderr("built with " OPENSSL_VERSION_TEXT
 " (running with ");
ngx_write_stderr((char *) (uintptr_t)
 SSLeay_version(SSLEAY_VERSION));
ngx_write_stderr(")" NGX_LINEFEED);
}
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
ngx_write_stderr("TLS SNI support enabled" NGX_LINEFEED);
#else
ngx_write_stderr("TLS SNI support disabled" NGX_LINEFEED);
#endif
#endif

ngx_write_stderr("configure arguments:" NGX_CONFIGURE
NGX_LINEFEED);
}
}




I think "stdout" is good, not "stderr", is this the design?


And I created patch for this problem.
---
[root@localhost ~]# diff -u ./src/core/nginx.c ./src2/core/nginx.c
--- ./src/core/nginx.c2016-02-10 22:56:57.915997223 +0900
+++ ./src2/core/nginx.c2016-02-09 23:11:57.0 +0900
@@ -374,10 +374,10 @@
 static void
 ngx_show_version_info()
 {
-ngx_write_stdout("nginx version: " NGINX_VER_BUILD NGX_LINEFEED);
+ngx_write_stderr("nginx version: " NGINX_VER_BUILD NGX_LINEFEED);

 if (ngx_show_help) {
-ngx_write_stdout(
+ngx_write_stderr(
 "Usage: nginx [-?hvVtTq] [-s signal] [-c filename] "
  "[-p prefix] [-g directives]" NGX_LINEFEED
  NGX_LINEFEED
@@ -409,27 +409,27 @@
 if (ngx_show_configure) {

 #ifdef NGX_COMPILER
-ngx_write_stdout("built by " NGX_COMPILER NGX_LINEFEED);
+ngx_write_stderr("built by " NGX_COMPILER NGX_LINEFEED);
 #endif

 #if (NGX_SSL)
 if (SSLeay() == SSLEAY_VERSION_NUMBER) {
-ngx_write_stdout("built with " OPENSSL_VERSION_TEXT
NGX_LINEFEED);
+ngx_write_stderr("built with " OPENSSL_VERSION_TEXT
NGX_LINEFEED);
 } else {
-ngx_write_stdout("built with " OPENSSL_VERSION_TEXT
+ngx_write_stderr("built with " OPENSSL_VERSION_TEXT
  " (running with ");
-ngx_write_stdout((char *) (uintptr_t)
+ngx_write_stderr((char *) (uintptr_t)
  SSLeay_version(SSLEAY_VERSION));
-ngx_write_stdout(")" NGX_LINEFEED);
+ngx_write_stderr(")" NGX_LINEFEED);
 }
 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
-ngx_write_stdout("TLS SNI support enabled" NGX_LINEFEED);
+ngx_write_stderr("TLS SNI support enabled" NGX_LINEFEED);
 #else
-ngx_write_stdout("TLS SNI support disabled" NGX_LINEFEED);
+ngx_write_stderr("TLS SNI support disabled" NGX_LINEFEED);
 #endif
 #endif

-ngx_write_stdout("configure arguments:" NGX_CONFIGURE
NGX_LINEFEED);
+ngx_write