Permalink
Browse files

Support for UTF-8 file names.

Thanks to Robbie Scott/Bandcamp
  • Loading branch information...
1 parent db7c1e3 commit 4f61592b9481c4f9a160bd59dbe42204c7c3d7b2 Evan Miller committed Apr 4, 2010
Showing with 10 additions and 7 deletions.
  1. +4 −4 ngx_http_zip_file.c
  2. +2 −0 ngx_http_zip_file_format.h
  3. +4 −3 t/nginx/conf/nginx.conf
View
@@ -64,7 +64,7 @@ static ngx_zip_data_descriptor_zip64_t ngx_zip_data_descriptor_zip64_template =
static ngx_zip_local_file_header_t ngx_zip_local_file_header_template = {
0x04034b50, /* local file header signature */
0x0a, /* version needed to extract */
- 0x08, /* general purpose bit flag */
+ zip_utf8_flag | zip_missing_crc32_flag, /* general purpose bit flag */
0, /* compression method */
0, /* last mod file date/time */
0, /* crc-32 */
@@ -79,7 +79,7 @@ static ngx_zip_central_directory_file_header_t ngx_zip_central_directory_file_he
0x02014b50, /* central file header signature */
zip_version_zip64, /* version made by */
zip_version_default, /* version needed to extract */
- 0x08, /* general purpose bit flag */
+ zip_utf8_flag | zip_missing_crc32_flag, /* general purpose bit flag */
0, /* compression method */
0, /* last mod file time */
0, /* crc-32 */
@@ -277,7 +277,7 @@ ngx_http_zip_file_header_chain_link(ngx_http_request_t *r, ngx_http_zip_ctx_t *c
}
if (!file->missing_crc32) {
- local_file_header.flags = 0;
+ local_file_header.flags &= ~zip_missing_crc32_flag;
local_file_header.crc32 = file->crc32;
}
@@ -435,7 +435,7 @@ ngx_http_zip_write_central_directory_entry(u_char *p, ngx_http_zip_file_t *file,
if (!file->need_zip64_offset)
central_directory_file_header.offset = file->offset;
if (!file->missing_crc32)
- central_directory_file_header.flags = 0;
+ central_directory_file_header.flags &= ~zip_missing_crc32_flag;
if (file->need_zip64) {
central_directory_file_header.version_needed = zip_version_zip64;
@@ -7,6 +7,8 @@
#define zip_version_default 10
#define zip_version_zip64 45
+#define zip_utf8_flag 0x0800
+#define zip_missing_crc32_flag 0x08
typedef struct {
uint16_t tag; //0x5455
@@ -3,7 +3,7 @@
worker_processes 1;
#error_log logs/error.log;
-error_log logs/error.log debug;
+error_log logs/error-if-range.log debug;
#error_log logs/error.log notice;
#error_log logs/error.log info;
@@ -47,7 +47,9 @@ http {
}
location /zip {
- add_header X-Archive-Files zip;
+ add_header X-Archive-Files zip;
+ add_header Last-Modified "Wed, 15 Nov 1995 04:58:08 GMT";
+ add_header ETag "3.14159";
}
}
@@ -68,7 +70,6 @@ http {
location /local {
alias html;
- index index.html index.htm;
}
#error_page 404 /404.html;

0 comments on commit 4f61592

Please sign in to comment.