Welcome! Log In Create A New Profile

Advanced

Re: Nginx_upload_progress_module and jquery-1.4

Valery Kholodkov
January 15, 2010 06:06AM
----- dimkalinux <dimkalinux@gmail.com> wrote:
> Вышел JQuery 1.4 и я попытался заменить им предыдущую версию 1.3.2.
> Всё заработало, кроме Nginx_upload_progress_module.
> AJAX запрос к модулю вызывает ошибку. В документации к JQuery указано,
> что в новой версии jQuery 1.3 and earlier used JavaScript’s eval to
> evaluate incoming JSON. jQuery 1.4 uses the native JSON parser if
> available. It also validates incoming JSON for validity, so malformed
> JSON (for instance {foo: "bar"}) will be rejected by jQuery in
> jQuery.getJSON and when specifying “json” as the dataType of an Ajax
> request.
>
> Кто знает как пропатчить модуль для выдачи корректного JSON?
>
> Сейчас в модуле JSON генерируется так:
>
> static ngx_str_t ngx_http_uploadprogress_json_defaults[] = {
> ngx_string("{ \"state\" : \"starting\" }\r\n"),
> ngx_string("{ \"state\" : \"error\", \"status\" :
> $uploadprogress_status }\r\n"),
> ngx_string("{ \"state\" : \"done\" }\r\n"),
> ngx_string("{ \"state\" : \"uploading\", \"received\" :
> $uploadprogress_received, \"size\" : $uploadprogress_length }\r\n")
> };

Могу предположить, что нужно удалить \r\n и пробелы:

static ngx_str_t ngx_http_uploadprogress_json_defaults[] = {
ngx_string("{\"state\":\"starting\"}"),
ngx_string("{\"state\":\"error\",\"status\":$uploadprogress_status}"),
ngx_string("{\"state\":\"done\"}"),
ngx_string("{\"state\":\"uploading\",\"received\":$uploadprogress_received,\"size\":$uploadprogress_length}")
};

Тем не менее, неплохо бы узнать, что парсер считает невалидным.

--
Regards,
Valery Kholodkov

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

Nginx_upload_progress_module and jquery-1.4

dimkalinux January 15, 2010 05:22AM

Re: Nginx_upload_progress_module and jquery-1.4

Valery Kholodkov January 15, 2010 06:06AM

Re: Nginx_upload_progress_module and jquery-1.4

dimkalinux January 15, 2010 07:26AM

Re: Nginx_upload_progress_module and jquery-1.4

Valery Kholodkov January 15, 2010 07:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 227
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready