Bladeren bron

Added directive to specify content type of progress report

tags/v0.7
Valery Kholodkov 17 jaren geleden
bovenliggende
commit
7b3ef91c10
1 gewijzigde bestanden met toevoegingen van 11 en 2 verwijderingen
  1. 11
    2
      ngx_http_uploadprogress_module.c

+ 11
- 2
ngx_http_uploadprogress_module.c Bestand weergeven

44
     ngx_event_t                      cleanup;
44
     ngx_event_t                      cleanup;
45
     ngx_http_handler_pt              handler;
45
     ngx_http_handler_pt              handler;
46
     u_char                           track;
46
     u_char                           track;
47
+    ngx_str_t                        content_type;
47
 } ngx_http_uploadprogress_conf_t;
48
 } ngx_http_uploadprogress_conf_t;
48
 
49
 
49
 typedef struct {
50
 typedef struct {
88
      0,
89
      0,
89
      NULL},
90
      NULL},
90
 
91
 
92
+    {ngx_string("upload_progress_content_type"),
93
+     NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1,
94
+     ngx_conf_set_str_slot,
95
+     NGX_HTTP_LOC_CONF_OFFSET,
96
+     offsetof(ngx_http_uploadprogress_conf_t, content_type),
97
+     NULL},
98
+
91
     ngx_null_command
99
     ngx_null_command
92
 };
100
 };
93
 
101
 
460
 	ngx_free(id);
468
 	ngx_free(id);
461
 
469
 
462
     /* send the output */
470
     /* send the output */
463
-    r->headers_out.content_type.len = sizeof("text/javascript") - 1;
464
-    r->headers_out.content_type.data = (u_char *) "text/javascript";
471
+    r->headers_out.content_type = upcf->content_type;
465
 
472
 
466
     /* force no-cache */
473
     /* force no-cache */
467
     expires = r->headers_out.expires;
474
     expires = r->headers_out.expires;
1127
         *conf = *prev;
1134
         *conf = *prev;
1128
     }
1135
     }
1129
 
1136
 
1137
+    ngx_conf_merge_str_value(conf->content_type, prev->content_type, "text/javascript");
1138
+
1130
     return NGX_CONF_OK;
1139
     return NGX_CONF_OK;
1131
 }
1140
 }
1132
 
1141
 

Laden…
Annuleren
Opslaan