Re: [nginx] Update mime-types

2024-02-25 Thread Izorkin
Hello, 
Maksim.


Like 
that?


# 
HG 
changeset 
patch
# 
User 
Yuriy 
Izorkin 

# 
Date 
1708074268 
-10800
# 
 
 
 
 
 
Fri 
Feb 
16 
12:04:28 
2024 
+0300
# 
Branch 
update-mime-types
# 
Node 
ID 
2343683b93bc2144073e4c808a3951de83b67d95
# 
Parent 
 
89bff782528a91ad123b63b624f798e6fd9c8e68
MIME: 
change 
type 
image/x-ms-bmp 
to 
image/image


For 
.bmp 
and 
.dib 
files 
the 
image/bmp 
mime 
type 
is 
used 
according 
to 
IANA 
[1].
Apache 
also 
uses 
this 
type 
[2].


The 
.dib 
file 
is 
a 
BMP 
file 
without 
the 
14-byte 
file 
header 
[3].


Extension 
usage 
statistics, 
according 
to 
httparhcive.org:
$ 
awk 
'NR==1||/^bmp,/||/^dib,/' 
httparchive_exts.csv

ext,total_pages,total_requests
bmp,17013,37954
dib,22,28

The 
csv 
file 
was 
made 
with 
the 
following 
query:


SELECT
 
 
ext,
 
 
COUNT(distinct 
pageid) 
total_pages,
 
 
COUNT(0) 
total_requests

FROM
 
 
`httparchive.summary_requests.2024_01_01_desktop`
GROUP 
BY
 
 
ext
ORDER 
BY
 
 
total_requests 
DESC


Link 
for 
reference:


[1] 
https://www.iana.org/assignments/media-types/image/bmp
[2] 
https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
[3] 
http://fileformats.archiveteam.org/wiki/BMP
[4] 
https://httparchive.org


This 
will 
require 
a 
lot 
of 
free 
time 
:(



Maxim 
Dounin 
писал(а) 
2024-02-24 
05:01:
I would suggest to provide more details and rationale for 
each
change suggested: why the change is needed, which problems 
it
solves, if there are any compatibility concerns, and so 
on.



I 
tried 
to 
cover 
all 
possible 
options 
so 
that 
wouldn't 
have 
to 
manually
change 
the 
conf/mime.types 
file 
if 
needed. 
For 
example. 
This 
is
problematic 
to 
do 
in 
NixOS, 
because 
will 
need 
to 
make 
changes 
at 
the 
OS
level, 
because 
by 
default 
the 
file 
is 
locked 
for 
modification.



Note well that nginx (and freenginx) does not try to provide 
all
existing MIME types and extensions in the mime.types file, 
but
rather lists most common ones.  As such, it when adding new 
types
and extensions there should be some justification that it needs 
to
be added (httparchive.org might be a good data source 
here).



--
Best 
regards,

Izorkin
mailto:izor...@elven.pw

0xD06A6838.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature
-- 
nginx-devel mailing list
nginx-devel@freenginx.org
https://freenginx.org/mailman/listinfo/nginx-devel


[nginx] Version bump.

2024-02-25 Thread Maxim Dounin
details:   http://freenginx.org/hg/nginx/rev/a7c41e449bbe
branches:  
changeset: 9221:a7c41e449bbe
user:  Maxim Dounin 
date:  Mon Feb 26 00:40:35 2024 +0300
description:
Version bump.

diffstat:

 src/core/nginx.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (14 lines):

diff --git a/src/core/nginx.h b/src/core/nginx.h
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -9,8 +9,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version  1025004
-#define NGINX_VERSION  "1.25.4"
+#define nginx_version  1025005
+#define NGINX_VERSION  "1.25.5"
 
 #define NGINX_NAME "freenginx"
 #define NGINX_VER  NGINX_NAME "/" NGINX_VERSION
-- 
nginx-devel mailing list
nginx-devel@freenginx.org
https://freenginx.org/mailman/listinfo/nginx-devel


[nginx] Fixed server name in HTTP/1.x with "server_tokens off;".

2024-02-25 Thread Maxim Dounin
details:   http://freenginx.org/hg/nginx/rev/0b51902d9f24
branches:  
changeset: 9222:0b51902d9f24
user:  Tatsuya Kaneko 
date:  Mon Feb 26 00:40:58 2024 +0300
description:
Fixed server name in HTTP/1.x with "server_tokens off;".

Missed in 9213:23f109f0facc.

diffstat:

 src/http/ngx_http_header_filter_module.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff --git a/src/http/ngx_http_header_filter_module.c 
b/src/http/ngx_http_header_filter_module.c
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -46,7 +46,7 @@ ngx_module_t  ngx_http_header_filter_mod
 };
 
 
-static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
+static u_char ngx_http_server_string[] = "Server: " NGINX_NAME CRLF;
 static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
 static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;
 
-- 
nginx-devel mailing list
nginx-devel@freenginx.org
https://freenginx.org/mailman/listinfo/nginx-devel


Re: Patch: Update Server Header for HTTP/1.1

2024-02-25 Thread Maxim Dounin
Hello!

On Sun, Feb 25, 2024 at 11:57:21AM +0900, Tatsuya Kaneko wrote:

> Thank you. LGTM.

Committed, thanks.

http://freenginx.org/hg/nginx/rev/0b51902d9f24

-- 
Maxim Dounin
http://mdounin.ru/
-- 
nginx-devel mailing list
nginx-devel@freenginx.org
https://freenginx.org/mailman/listinfo/nginx-devel


Re: [nginx] Update mime-types

2024-02-25 Thread Maxim Dounin
Hello!

On Sun, Feb 25, 2024 at 03:33:32PM +0300, Izorkin wrote:

> Hello, Maksim.
> 
> Like that?
> 
> # HG changeset patch
> # User Yuriy Izorkin 
> # Date 1708074268 -10800
> #   Fri Feb 16 12:04:28 2024 +0300
> # Branch update-mime-types
> # Node ID 2343683b93bc2144073e4c808a3951de83b67d95
> # Parent   89bff782528a91ad123b63b624f798e6fd9c8e68
> MIME: change type image/x-ms-bmp to image/image
> 
> For .bmp and .dib files the image/bmp mime type is used according to IANA
> [1].
> Apache also uses this type [2].
> 
> The .dib file is a BMP file without the 14-byte file header [3].
> 
> Extension usage statistics, according to httparhcive.org:
> $ awk 'NR==1||/^bmp,/||/^dib,/' httparchive_exts.csv
> ext,total_pages,total_requests
> bmp,17013,37954
> dib,22,28
> 
> The csv file was made with the following query:
> 
> SELECT
> ext,
> COUNT(distinct pageid) total_pages,
> COUNT(0) total_requests
> FROM
> `httparchive.summary_requests.2024_01_01_desktop`
> GROUP BY
> ext
> ORDER BY
> total_requests DESC
> 
> Link for reference:
> 
> [1] https://www.iana.org/assignments/media-types/image/bmp
> [2] https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
> [3] http://fileformats.archiveteam.org/wiki/BMP
> [4] https://httparchive.org

Something like, except that the data as provided make it clear 
that:

1. There are two changes, one to change the MIME type for bmp 
files, and another one to add dib files.

2. The "dib" extension is not really used, as shown by 
the httparchive.org data.  And even if used, it does not really mean 
the contents are the same as in BMP files, but "sometimes 
indicates that the file lacks a file header" (quote from the [3] 
link).

Also, most of the information can be used during initial 
preparation of the patch set, that is, to filter out irrelevant 
changes and new types and extensions which aren't used in 
practice.

> This will require a lot of free time :(

That's a work which needs to be done anyway.  I did it myself for 
the first several patches you've submitted, and the outcome is 
that only the bmp MIME type change from image/x-ms-bmp to 
image/bmp looks legitimate (and mostly because of browser 
handling, which changed over time).

> Maxim Dounin писал(а) 2024-02-24 05:01:
> > I would suggest to provide more details and rationale for each
> > change suggested: why the change is needed, which problems it
> > solves, if there are any compatibility concerns, and so on.
> 
> 
> I tried to cover all possible options so that wouldn't have to manually
> change the conf/mime.types file if needed. For example. This is
> problematic to do in NixOS, because will need to make changes at the OS
> level, because by default the file is locked for modification.

Note that it is generally trivial to add additional types in 
nginx.conf, without touching the mime.types file, with something 
like:

   include mime.types;
   types {
   image/bmp  dib;
   image/foo  foo;
   }

It is also possible to redefine types for extensions which are 
already in mime.types, though nginx will warn when you redefine an 
extension to a different type.

> > Note well that nginx (and freenginx) does not try to provide all
> > existing MIME types and extensions in the mime.types file, but
> > rather lists most common ones.  As such, it when adding new types
> > and extensions there should be some justification that it needs to
> > be added (httparchive.org might be a good data source here).

-- 
Maxim Dounin
http://mdounin.ru/
-- 
nginx-devel mailing list
nginx-devel@freenginx.org
https://freenginx.org/mailman/listinfo/nginx-devel


Re: Patch: Update Server Header for HTTP/1.1

2024-02-25 Thread Tatsuya Kaneko
Thank you!

2024年2月26日(月) 6:44 Maxim Dounin :

> Hello!
>
> On Sun, Feb 25, 2024 at 11:57:21AM +0900, Tatsuya Kaneko wrote:
>
> > Thank you. LGTM.
>
> Committed, thanks.
>
> http://freenginx.org/hg/nginx/rev/0b51902d9f24
>
> --
> Maxim Dounin
> http://mdounin.ru/
> --
> nginx-devel mailing list
> nginx-devel@freenginx.org
> https://freenginx.org/mailman/listinfo/nginx-devel
>
-- 
nginx-devel mailing list
nginx-devel@freenginx.org
https://freenginx.org/mailman/listinfo/nginx-devel


Patch: "freenginx" name used in responses with HTTP/1.1

2024-02-25 Thread Fabiano Furtado Pessoa Coelho
Hi... the "nginx" name is still used in HTTP/1.1 with the
"server_tokens off;" directive in freenginx-1.25.4.

Please, consider analyzing this simple patch.

Thanks in advance.
Fabiano

/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */


#include 
#include 
#include 
#include 


static ngx_int_t ngx_http_header_filter_init(ngx_conf_t *cf);
static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r);


static ngx_http_module_t  ngx_http_header_filter_module_ctx = {
NULL,  /* preconfiguration */
ngx_http_header_filter_init,   /* postconfiguration */

NULL,  /* create main configuration */
NULL,  /* init main configuration */

NULL,  /* create server configuration */
NULL,  /* merge server configuration */

NULL,  /* create location configuration */
NULL,  /* merge location configuration */
};


ngx_module_t  ngx_http_header_filter_module = {
NGX_MODULE_V1,
&ngx_http_header_filter_module_ctx,/* module context */
NULL,  /* module directives */
NGX_HTTP_MODULE,   /* module type */
NULL,  /* init master */
NULL,  /* init module */
NULL,  /* init process */
NULL,  /* init thread */
NULL,  /* exit thread */
NULL,  /* exit process */
NULL,  /* exit master */
NGX_MODULE_V1_PADDING
};


static u_char ngx_http_server_string[] = "Server: " NGINX_NAME CRLF;
static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;


static ngx_str_t ngx_http_status_lines[] = {

ngx_string("200 OK"),
ngx_string("201 Created"),
ngx_string("202 Accepted"),
ngx_null_string,  /* "203 Non-Authoritative Information" */
ngx_string("204 No Content"),
ngx_null_string,  /* "205 Reset Content" */
ngx_string("206 Partial Content"),

/* ngx_null_string, */  /* "207 Multi-Status" */

#define NGX_HTTP_LAST_2XX  207
#define NGX_HTTP_OFF_3XX   (NGX_HTTP_LAST_2XX - 200)

/* ngx_null_string, */  /* "300 Multiple Choices" */

ngx_string("301 Moved Permanently"),
ngx_string("302 Moved Temporarily"),
ngx_string("303 See Other"),
ngx_string("304 Not Modified"),
ngx_null_string,  /* "305 Use Proxy" */
ngx_null_string,  /* "306 unused" */
ngx_string("307 Temporary Redirect"),
ngx_string("308 Permanent Redirect"),

#define NGX_HTTP_LAST_3XX  309
#define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)

ngx_string("400 Bad Request"),
ngx_string("401 Unauthorized"),
ngx_string("402 Payment Required"),
ngx_string("403 Forbidden"),
ngx_string("404 Not Found"),
ngx_string("405 Not Allowed"),
ngx_string("406 Not Acceptable"),
ngx_null_string,  /* "407 Proxy Authentication Required" */
ngx_string("408 Request Time-out"),
ngx_string("409 Conflict"),
ngx_string("410 Gone"),
ngx_string("411 Length Required"),
ngx_string("412 Precondition Failed"),
ngx_string("413 Request Entity Too Large"),
ngx_string("414 Request-URI Too Large"),
ngx_string("415 Unsupported Media Type"),
ngx_string("416 Requested Range Not Satisfiable"),
ngx_null_string,  /* "417 Expectation Failed" */
ngx_null_string,  /* "418 unused" */
ngx_null_string,  /* "419 unused" */
ngx_null_string,  /* "420 unused" */
ngx_string("421 Misdirected Request"),
ngx_null_string,  /* "422 Unprocessable Entity" */
ngx_null_string,  /* "423 Locked" */
ngx_null_string,  /* "424 Failed Dependency" */
ngx_null_string,  /* "425 unused" */
ngx_null_string,  /* "426 Upgrade Required" */
ngx_null_string,  /* "427 unused" */
ngx_null_string,  /* "428 Precondition Required" */
ngx_string("429 Too Many Requests"),

#define NGX_HTTP_LAST_4XX  430
#define NGX_HTTP_OFF_5XX   (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)

ngx_string("500 Internal Server Error"),
ngx_string("501 Not Implemented"),
ngx_string("502 Bad Gateway"),
ngx_string("503 Service Temporarily Unavailable"),
ngx_string("504 Gateway Time-out"),
ngx_string("505 HTTP Version Not Supported"),
ngx_null_string,/* "506 Variant Also Negotiates" */
ngx_string("507 Insufficient Storage"),

/* ngx_null_string, */  /* "508 unused" */
/* ngx_null_string, */  /* "509 unused" */
/* ngx_null_string, */  /* "510 Not Extended" */

#define NGX_HTTP_LAST_5XX  508

};


ngx_http_header_out_t  ngx_http_headers_out[] = {
{ ngx_string("Server"),

Re: Patch: "freenginx" name used in responses with HTTP/1.1

2024-02-25 Thread Maxim Dounin
Hello!

On Sun, Feb 25, 2024 at 09:41:26PM -0300, Fabiano Furtado Pessoa Coelho wrote:

> Hi... the "nginx" name is still used in HTTP/1.1 with the
> "server_tokens off;" directive in freenginx-1.25.4.
> 
> Please, consider analyzing this simple patch.

[...]

Thanks, just fixed:

http://freenginx.org/pipermail/nginx-devel/2024-February/62.html
http://freenginx.org/hg/nginx/rev/0b51902d9f24

-- 
Maxim Dounin
http://mdounin.ru/
-- 
nginx-devel mailing list
nginx-devel@freenginx.org
https://freenginx.org/mailman/listinfo/nginx-devel