Upload Progress Issue -- do not have "uploading" state

Yanxin Z. lists at ruby-forum.com
Thu Apr 21 10:24:06 MSD 2011


I print out the debug


2021 2011/04/20 17:28:07 [debug] 28372#0: *6 http script var: 
"/opt/nginx/html/api/1.0/web/           upload_internal/"
2022 2011/04/20 17:28:07 [debug] 28372#0: *6 http script copy: "^@"
2023 2011/04/20 17:28:07 [debug] 28372#0: *6 http script file op 
0000000000000005 "/opt/nginx/        html/api/1.0/web/upload_internal/"
2024 2011/04/20 17:28:07 [debug] 28372#0: *6 http script if
2025 2011/04/20 17:28:07 [debug] 28372#0: *6 http script regex: 
"(.*)/upload$"
2026 2011/04/20 17:28:07 [notice] 28372#0: *6 "(.*)/upload$" does not 
match "/api/1.0/web/            upload_internal/", client: 10.31.1.100, 
server: localhost, request: "POST /api/1.0/web/ 
upload_internal/?X-Progress-ID=db298fe5d036a8ae19d2a55b9d1d0ca9 
HTTP/1.1", host: "10.1.4.        243", referrer: 
"https://10.1.4.243/api/1.0/web/upload"
2027 2011/04/20 17:28:07 [debug] 28372#0: *6 test location: "/"
2028 2011/04/20 17:28:07 [debug] 28372#0: *6 test location: "progress"
2029 2011/04/20 17:28:07 [debug] 28372#0: *6 test location: "50x.html"
2030 2011/04/20 17:28:07 [debug] 28372#0: *6 test location: ~ 
"/api/1.0/web/upload.php"
2031 2011/04/20 17:28:07 [debug] 28372#0: *6 test location: ~ 
"/api/1.0/web/.*php$"
2032 2011/04/20 17:28:07 [debug] 28372#0: *6 test location: ~ 
"/api/1.0/web/upload_internal"
2033 2011/04/20 17:28:07 [debug] 28372#0: *6 using configuration 
"/api/1.0/web/upload_internal"
2034 2011/04/20 17:28:07 [debug] 28372#0: *6 http cl:29308 max:10485760
2035 2011/04/20 17:28:07 [debug] 28372#0: *6 rewrite phase: 2
2036 2011/04/20 17:28:07 [debug] 28372#0: *6 upload-progress: 
get_tracking_id
2037 2011/04/20 17:28:07 [debug] 28372#0: *6 upload-progress: 
get_tracking_id no header found
2038 2011/04/20 17:28:07 [debug] 28372#0: *6 upload-progress: 
get_tracking_id no header found,        args found
2039 2011/04/20 17:28:07 [debug] 28372#0: *6 upload-progress: 
get_tracking_id found args: X- 
Progress-ID=db298fe5d036a8ae19d2a55b9d1d0ca9 HTTP/1.1^M
2040 Host
2041 2011/04/20 17:28:07 [debug] 28372#0: *6 malloc: 0000000010B7CF40:16
2042 2011/04/20 17:28:07 [debug] 28372#0: *6 upload-progress: 
get_tracking_id found args:             db298fe5d036a8ae19d2a55b9d1d0ca9
2043 2011/04/20 17:28:07 [debug] 28372#0: *6 trackuploads id found: 
db298fe5d036a8ae19d2a55b9d1d0ca9
2044 2011/04/20 17:28:07 [debug] 28372#0: *6 trackuploads hash 5351D33B 
for id:                       db298fe5d036a8ae19d2a55b9d1d0ca9
2045 2011/04/20 17:28:07 [debug] 28372#0: *6 upload-progress: find_node 
db298fe5d036a8ae19d2a55b9d1d0ca9
2046 2011/04/20 17:28:07 [debug] 28372#0: *6 upload-progress: can't find 
node
2047 2011/04/20 17:28:07 [debug] 28372#0: *6 add cleanup: 
0000000010B7F670
2048 2011/04/20 17:28:07 [debug] 28372#0: slab alloc: 136 slot: 5
2049 2011/04/20 17:28:07 [debug] 28372#0: slab alloc: 00002B65BDE08000
2050 2011/04/20 17:28:07 [debug] 28372#0: *6 trackuploads: 5351D33B 
inserted in rbtree
2051 2011/04/20 17:28:07 [debug] 28372#0: event timer add: 7: 
15000:1303345702489
2052 2011/04/20 17:28:07 [debug] 28372#0: *6 rewrite phase: 3
2053 2011/04/20 17:28:07 [debug] 28372#0: *6 http script var
2054 2011/04/20 17:28:07 [debug] 28372#0: *6 http script var: "POST"
2055 2011/04/20 17:28:07 [debug] 28372#0: *6 http script value: "POST"
2056 2011/04/20 17:28:07 [debug] 28372#0: *6 http script equal

I look at the code, in find_node(), I find out node and sentinel are 
NULL.
So it does not go into while loop.

 350 static ngx_http_uploadprogress_node_t *
 351 find_node(ngx_str_t * id, ngx_http_uploadprogress_ctx_t * ctx, 
ngx_log_t * log)
 352 {
 353     uint32_t                         hash;
 354     ngx_rbtree_node_t               *node, *sentinel;
 355     ngx_int_t                        rc;
 356     ngx_http_uploadprogress_node_t  *up;
 357
 358     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "upload-progress: 
find_node          %V", id);
 359
 360     hash = ngx_crc32_short(id->data, id->len);
 361
 362     node = ctx->rbtree->root;
 363     sentinel = ctx->rbtree->sentinel;
 364
 365     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "upload-progress: 
node: %V           sentinel: %V", node, sentinel);
 366
 367     while (node != sentinel) {
 368
 369         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, 
"upload-progress: hash: %V       node->key: %V", hash, node->key);
 370         if (hash < node->key) {
 371
 372             node = node->left;
 373             continue;
 374         }
 375
 376         if (hash > node->key) {
 377             node = node->right;
 378             continue;
 379         }
 380
 381         /* hash == node->key */
 382
 383         do {
 384
 385             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, 
"upload-progress: In         while");
 386             up = (ngx_http_uploadprogress_node_t *) node;
 387
 388             rc = ngx_memn2cmp(id->data, up->data, id->len, (size_t) 
up->len);
 389
 390             if (rc == 0) {
 391                 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0,
 392                                "upload-progress: found node");
 393                 return up;
 394             }


I want to know which function to initialize node and sentinel.

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list