Welcome! Log In Create A New Profile

Advanced

Re: Upload Module - add response header with MD5

Francis Daly
August 20, 2012 03:20PM
On Mon, Aug 20, 2012 at 03:28:59AM -0400, mokriy wrote:

Hi there,

> Basically, I am using the one from Valeriy Kholodkov:
> http://www.grid.net.ru/nginx/upload.ru.html
>
> upload_add_header feature appeared in v 2.2, I guess:

Ah, you're using a development work-in-progress version.

upload_add_header is not in the released 2.2.0 tarball.

> https://github.com/vkholodkov/nginx-upload-module/blob/2.2/ngx_http_upload_module.c
> I can find it in C code - 'upload_add_header'.

I guess you've found a bug in the development code.

> However the MD5 hashes returned in response header are.. not hashes.
> They are:
> 34383765656261393461336230613362 OR
> 34396436323764343839623564646664

It looks like it isn't a new bug in the post-2.2.0 code; but
upload_add_header makes it easier to expose.

It appears that (at least) for the aggregate variables, accessing one
more than once will cause the previous value to be read as bytes, and
written in hexadecimal ascii representation.

So in your first example above, the md5sum began 487eeba94a3b0a3b.

Test with something like

upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5;
upload_aggregate_form_field "${upload_field_name}_md6" $upload_file_md5;
upload_aggregate_form_field "${upload_field_name}_md7" $upload_file_md5;
upload_aggregate_form_field "${upload_field_name}_md8" $upload_file_md5;

and you'll see that the later values include increasing strings of 3s.

(Of course, it was never sane to use $upload_file_md5 more than once,
so this didn't matter. But now it is, and it does.)

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Upload Module - add response header with MD5

mokriy August 18, 2012 06:54AM

Re: Upload Module - add response header with MD5

Francis Daly August 18, 2012 07:38PM

Re: Upload Module - add response header with MD5

mokriy August 20, 2012 03:28AM

Re: Upload Module - add response header with MD5

Francis Daly August 20, 2012 03:20PM

Re: Upload Module - add response header with MD5

mokriy August 21, 2012 03:52AM

Re: Upload Module - add response header with MD5

Valery Kholodkov August 21, 2012 04:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 152
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready