Ver código fonte

fixed tabs/indent

tags/v0.4
Brice Figureau 18 anos atrás
pai
commit
401a1391ee
1 arquivos alterados com 52 adições e 59 exclusões
  1. 52
    59
      ngx_http_uploadprogress_module.c

+ 52
- 59
ngx_http_uploadprogress_module.c Ver arquivo

152
             ret = ngx_pcalloc(r->pool, sizeof(ngx_str_t));
152
             ret = ngx_pcalloc(r->pool, sizeof(ngx_str_t));
153
             ret->data = header[i].value.data;
153
             ret->data = header[i].value.data;
154
             ret->len = header[i].value.len;
154
             ret->len = header[i].value.len;
155
-				    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
156
-			                     "upload-progress: get_tracking_id found header: %V", ret);
155
+            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
156
+                            "upload-progress: get_tracking_id found header: %V", ret);
157
             return ret;
157
             return ret;
158
         }
158
         }
159
     }
159
     }
160
 
160
 
161
-		ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
162
-		               "upload-progress: get_tracking_id no header found");
161
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
162
+                    "upload-progress: get_tracking_id no header found");
163
 
163
 
164
     /* not found, check as a reaquest arg */
164
     /* not found, check as a reaquest arg */
165
     if (r->args.len) {
165
     if (r->args.len) {
179
                 break;
179
                 break;
180
         } 
180
         } 
181
         while(p++);
181
         while(p++);
182
-				
182
+
183
         if (i) {
183
         if (i) {
184
             start_p = p += 14;
184
             start_p = p += 14;
185
             while (p < r->args.data + r->args.len) {
185
             while (p < r->args.data + r->args.len) {
191
             ret = ngx_pcalloc(r->pool, sizeof(ngx_str_t));
191
             ret = ngx_pcalloc(r->pool, sizeof(ngx_str_t));
192
             ret->data = start_p;
192
             ret->data = start_p;
193
             ret->len = p - start_p;
193
             ret->len = p - start_p;
194
-						ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
195
-						               "upload-progress: get_tracking_id found args: %V",ret);
194
+            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
195
+                           "upload-progress: get_tracking_id found args: %V",ret);
196
             return ret;
196
             return ret;
197
         }
197
         }
198
     }
198
     }
199
-		
200
-		ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
201
-		               "upload-progress: get_tracking_id no id found");
199
+
200
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
201
+                   "upload-progress: get_tracking_id no id found");
202
     return NULL;
202
     return NULL;
203
 }
203
 }
204
 
204
 
266
     rc = upcf->handler(r);
266
     rc = upcf->handler(r);
267
 
267
 
268
     /* bail out if error */
268
     /* bail out if error */
269
-		if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
270
-			return rc;
271
-		
272
-		/* request is OK, hijack the read_event_handler */
269
+    if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
270
+      return rc;
271
+    
272
+    /* request is OK, hijack the read_event_handler */
273
     upcf->read_event_handler = r->read_event_handler;
273
     upcf->read_event_handler = r->read_event_handler;
274
     r->read_event_handler = ngx_http_uploadprogress_event_handler;
274
     r->read_event_handler = ngx_http_uploadprogress_event_handler;
275
     return rc;
275
     return rc;
286
 
286
 
287
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "upload-progress: ngx_http_uploadprogress_event_handler");
287
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "upload-progress: ngx_http_uploadprogress_event_handler");
288
     
288
     
289
-		c = r->connection;
290
-		
289
+    c = r->connection;
290
+    
291
     /* call the original read event handler */
291
     /* call the original read event handler */
292
     upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
292
     upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
293
     upcf->read_event_handler(r);
293
     upcf->read_event_handler(r);
294
 
294
 
295
-		/* check that the request/connection is still OK */
296
-		if (r->headers_out.status >= NGX_HTTP_SPECIAL_RESPONSE) {
297
-			return;
298
-		}
295
+    /* check that the request/connection is still OK */
296
+    if (r->headers_out.status >= NGX_HTTP_SPECIAL_RESPONSE) {
297
+        return;
298
+    }
299
 
299
 
300
     /* find node, update rest */
300
     /* find node, update rest */
301
     id = get_tracking_id(r);
301
     id = get_tracking_id(r);
395
     if (up != NULL) {
395
     if (up != NULL) {
396
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
396
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
397
                        "reportuploads found node: %V", id);
397
                        "reportuploads found node: %V", id);
398
-				rest = up->rest;
399
-				length = up->length;
400
-				done = up->done;
401
-				err_status = up->err_status;
402
-				found = 1;
398
+        rest = up->rest;
399
+        length = up->length;
400
+        done = up->done;
401
+        err_status = up->err_status;
402
+        found = 1;
403
     } else {
403
     } else {
404
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
404
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
405
                        "reportuploads not found: %V", id);
405
                        "reportuploads not found: %V", id);
488
  */
488
  */
489
 
489
 
490
     if (!found) {
490
     if (!found) {
491
-      size = sizeof("new Object({ 'state' : 'starting' })\r\n");			
492
-		} else if (err_status >= NGX_HTTP_SPECIAL_RESPONSE) {
491
+        size = sizeof("new Object({ 'state' : 'starting' })\r\n");			
492
+    } else if (err_status >= NGX_HTTP_SPECIAL_RESPONSE) {
493
         size = sizeof("new Object({ 'state' : 'error', 'status' : ") + NGX_INT_T_LEN + sizeof(" })\r\n");
493
         size = sizeof("new Object({ 'state' : 'error', 'status' : ") + NGX_INT_T_LEN + sizeof(" })\r\n");
494
-		} else if (done) {
495
-    		size = sizeof("new Object({ 'state' : 'done' })\r\n");
496
-	  } else {
497
-        size =
498
-            sizeof("new Object({ 'state' : 'uploading', 'received' : ") +
499
-            NGX_INT_T_LEN + sizeof(" })\r\n");
494
+    } else if (done) {
495
+        size = sizeof("new Object({ 'state' : 'done' })\r\n");
496
+    } else {
497
+        size = sizeof("new Object({ 'state' : 'uploading', 'received' : ") + NGX_INT_T_LEN + sizeof(" })\r\n");
500
         size += sizeof(", 'size' : ") + NGX_INT_T_LEN;
498
         size += sizeof(", 'size' : ") + NGX_INT_T_LEN;
501
     }
499
     }
502
 
500
 
509
     out.next = NULL;
507
     out.next = NULL;
510
 
508
 
511
     if (!found) {
509
     if (!found) {
512
-      b->last = ngx_cpymem(b->last, "new Object({ 'state' : 'starting' })\r\n",
513
-                           sizeof("new Object({ 'state' : 'starting' })\r\n") -
514
-                           1);
515
-      ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
516
-                     "reportuploads returning starting");
517
-		} else if (err_status >= NGX_HTTP_SPECIAL_RESPONSE) {
518
-      b->last = ngx_cpymem(b->last, "new Object({ 'state' : 'error', 'status' : ",
510
+        b->last = ngx_cpymem(b->last, "new Object({ 'state' : 'starting' })\r\n",
511
+                            sizeof("new Object({ 'state' : 'starting' })\r\n") - 1);
512
+        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "reportuploads returning starting");
513
+    } else if (err_status >= NGX_HTTP_SPECIAL_RESPONSE) {
514
+        b->last = ngx_cpymem(b->last, "new Object({ 'state' : 'error', 'status' : ",
519
                              sizeof("new Object({ 'state' : 'error', 'status' : ") - 1);
515
                              sizeof("new Object({ 'state' : 'error', 'status' : ") - 1);
520
-  		b->last =	ngx_sprintf(b->last, "%ui })\r\n", err_status );
521
-      ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
522
-                     "reportuploads returning error condition: %ui", err_status);
523
-		} else if (done) {
524
-      b->last = ngx_cpymem(b->last, "new Object({ 'state' : 'done' })\r\n",
525
-                             sizeof("new Object({ 'state' : 'done' })\r\n") -
526
-                           1);
527
-      ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
528
-                     "reportuploads returning done");
529
-	  } else {
530
-      b->last =
531
-          ngx_cpymem(b->last, "new Object({ 'state' : 'uploading', 'received' : ",
532
-                       sizeof("new Object({ 'state' : 'uploading', 'received' : ") -
533
-                     1);
534
-
535
-      b->last = ngx_sprintf(b->last, "%uO, 'size' : %uO })\r\n", (length - rest), length);
536
-
537
-      ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
538
-				"reportuploads returning %uO / %uO",(length - rest), length );
516
+        b->last = ngx_sprintf(b->last, "%ui })\r\n", err_status );
517
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
518
+                        "reportuploads returning error condition: %ui", err_status);
519
+    } else if (done) {
520
+        b->last = ngx_cpymem(b->last, "new Object({ 'state' : 'done' })\r\n",
521
+                             sizeof("new Object({ 'state' : 'done' })\r\n") - 1);
522
+        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
523
+                        "reportuploads returning done");
524
+    } else {
525
+        b->last = ngx_cpymem(b->last, "new Object({ 'state' : 'uploading', 'received' : ",
526
+                             sizeof("new Object({ 'state' : 'uploading', 'received' : ") - 1);
527
+
528
+        b->last = ngx_sprintf(b->last, "%uO, 'size' : %uO })\r\n", (length - rest), length);
529
+
530
+        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
531
+                        "reportuploads returning %uO / %uO",(length - rest), length );
539
     }
532
     }
540
 
533
 
541
 
534
 

Carregando…
Cancelar
Salvar