@@ -94,6 +94,7 @@ static char *ngx_http_track_uploads(ngx_conf_t * cf, ngx_command_t * cmd, void *
94
94
static char * ngx_http_report_uploads (ngx_conf_t * cf , ngx_command_t * cmd , void * conf );
95
95
static char * ngx_http_upload_progress (ngx_conf_t * cf , ngx_command_t * cmd , void * conf );
96
96
static char * ngx_http_upload_progress_template (ngx_conf_t * cf , ngx_command_t * cmd , void * conf );
97
+ static char * ngx_http_upload_progress_java_output (ngx_conf_t * cf , ngx_command_t * cmd , void * conf );
97
98
static char * ngx_http_upload_progress_json_output (ngx_conf_t * cf , ngx_command_t * cmd , void * conf );
98
99
static char * ngx_http_upload_progress_jsonp_output (ngx_conf_t * cf , ngx_command_t * cmd , void * conf );
99
100
static void ngx_clean_old_connections (ngx_event_t * ev );
@@ -138,6 +139,13 @@ static ngx_command_t ngx_http_uploadprogress_commands[] = {
138
139
offsetof(ngx_http_uploadprogress_conf_t , templates ),
139
140
NULL },
140
141
142
+ {ngx_string ("upload_progress_java_output" ),
143
+ NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_NOARGS ,
144
+ ngx_http_upload_progress_java_output ,
145
+ NGX_HTTP_LOC_CONF_OFFSET ,
146
+ 0 ,
147
+ NULL },
148
+
141
149
{ngx_string ("upload_progress_json_output" ),
142
150
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_NOARGS ,
143
151
ngx_http_upload_progress_json_output ,
@@ -1330,9 +1338,9 @@ ngx_http_uploadprogress_init_variables_and_templates(ngx_conf_t *cf)
1330
1338
1331
1339
while (m -> name .data != NULL ) {
1332
1340
ngx_http_uploadprogress_template_t * elt = ngx_array_push (& ngx_http_uploadprogress_global_templates );
1333
- ngx_http_script_variables_count (ngx_http_uploadprogress_java_defaults + i );
1341
+ ngx_http_script_variables_count (ngx_http_uploadprogress_jsonp_defaults + i );
1334
1342
1335
- if (ngx_http_upload_progress_set_template (cf , elt , ngx_http_uploadprogress_java_defaults + i ) != NGX_CONF_OK ) {
1343
+ if (ngx_http_upload_progress_set_template (cf , elt , ngx_http_uploadprogress_jsonp_defaults + i ) != NGX_CONF_OK ) {
1336
1344
return NGX_ERROR ;
1337
1345
}
1338
1346
@@ -1543,6 +1551,30 @@ ngx_http_upload_progress_template(ngx_conf_t * cf, ngx_command_t * cmd, void *co
1543
1551
return ngx_http_upload_progress_set_template (cf , t , & value [2 ]);
1544
1552
}
1545
1553
1554
+ static char *
1555
+ ngx_http_upload_progress_java_output (ngx_conf_t * cf , ngx_command_t * cmd , void * conf )
1556
+ {
1557
+ ngx_http_uploadprogress_conf_t * upcf = conf ;
1558
+ ngx_http_uploadprogress_template_t * t ;
1559
+ ngx_uint_t i ;
1560
+ char * rc ;
1561
+
1562
+ t = (ngx_http_uploadprogress_template_t * )upcf -> templates .elts ;
1563
+
1564
+ for (i = 0 ;i < upcf -> templates .nelts ;i ++ ) {
1565
+ rc = ngx_http_upload_progress_set_template (cf , t + i , ngx_http_uploadprogress_java_defaults + i );
1566
+
1567
+ if (rc != NGX_CONF_OK ) {
1568
+ return rc ;
1569
+ }
1570
+ }
1571
+
1572
+ upcf -> content_type .data = (u_char * )"text/javascript" ;
1573
+ upcf -> content_type .len = sizeof ("text/javascript" ) - 1 ;
1574
+
1575
+ return NGX_CONF_OK ;
1576
+ }
1577
+
1546
1578
static char *
1547
1579
ngx_http_upload_progress_json_output (ngx_conf_t * cf , ngx_command_t * cmd , void * conf )
1548
1580
{
0 commit comments