Explorar el Código

Make session ID header name configurable

tags/v0.7
Valery Kholodkov hace 17 años
padre
commit
6c63c538c0
Se han modificado 1 ficheros con 15 adiciones y 4 borrados
  1. 15
    4
      ngx_http_uploadprogress_module.c

+ 15
- 4
ngx_http_uploadprogress_module.c Ver fichero

64
     u_char                           track;
64
     u_char                           track;
65
     ngx_str_t                        content_type;
65
     ngx_str_t                        content_type;
66
     ngx_array_t                      templates;
66
     ngx_array_t                      templates;
67
+    ngx_str_t                        header;
67
 } ngx_http_uploadprogress_conf_t;
68
 } ngx_http_uploadprogress_conf_t;
68
 
69
 
69
 typedef struct {
70
 typedef struct {
131
      0,
132
      0,
132
      NULL},
133
      NULL},
133
 
134
 
135
+    {ngx_string("upload_progress_header"),
136
+     NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1,
137
+     ngx_conf_set_str_slot,
138
+     NGX_HTTP_LOC_CONF_OFFSET,
139
+     offsetof(ngx_http_uploadprogress_conf_t, header),
140
+     NULL},
141
+
134
     ngx_null_command
142
     ngx_null_command
135
 };
143
 };
136
 
144
 
165
     NGX_MODULE_V1_PADDING
173
     NGX_MODULE_V1_PADDING
166
 };
174
 };
167
 
175
 
168
-static ngx_str_t x_progress_id = ngx_string("X-Progress-ID");
169
-
170
 static ngx_http_uploadprogress_state_map_t ngx_http_uploadprogress_state_map[] = {
176
 static ngx_http_uploadprogress_state_map_t ngx_http_uploadprogress_state_map[] = {
171
     {ngx_string("starting"),  uploadprogress_state_starting},
177
     {ngx_string("starting"),  uploadprogress_state_starting},
172
     {ngx_string("error"),     uploadprogress_state_error},
178
     {ngx_string("error"),     uploadprogress_state_error},
198
     ngx_list_part_t                 *part;
204
     ngx_list_part_t                 *part;
199
     ngx_table_elt_t                 *header;
205
     ngx_table_elt_t                 *header;
200
     ngx_str_t                       *ret, args;
206
     ngx_str_t                       *ret, args;
207
+    ngx_http_uploadprogress_conf_t  *upcf;
208
+
209
+    upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
201
 
210
 
202
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "upload-progress: get_tracking_id");
211
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "upload-progress: get_tracking_id");
203
 
212
 
216
             i = 0;
225
             i = 0;
217
         }
226
         }
218
 
227
 
219
-        if (header[i].key.len == x_progress_id.len
220
-            && ngx_strncasecmp(header[i].key.data, x_progress_id.data,
228
+        if (header[i].key.len == upcf->header.len
229
+            && ngx_strncasecmp(header[i].key.data, upcf->header.data,
221
                            header[i].key.len) == 0) {
230
                            header[i].key.len) == 0) {
222
             ret = ngx_calloc(sizeof(ngx_str_t), r->connection->log );
231
             ret = ngx_calloc(sizeof(ngx_str_t), r->connection->log );
223
             ret->data = header[i].value.data;
232
             ret->data = header[i].value.data;
1254
         }
1263
         }
1255
     } 
1264
     } 
1256
 
1265
 
1266
+    ngx_conf_merge_str_value(conf->header, prev->header, "X-Progress-ID");
1267
+
1257
     return NGX_CONF_OK;
1268
     return NGX_CONF_OK;
1258
 }
1269
 }
1259
 
1270
 

Loading…
Cancelar
Guardar