~ubuntu-branches/ubuntu/saucy/nginx/saucy-updates

« back to all changes in this revision

Viewing changes to debian/modules/nginx-upload-progress/ngx_http_uploadprogress_module.c

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry, Kartik Mistry
  • Date: 2011-09-26 10:17:04 UTC
  • mfrom: (4.2.38 sid)
  • Revision ID: package-import@ubuntu.com-20110926101704-x8pxngiujrmkxnn3
Tags: 1.1.4-2
[Kartik Mistry]
* debian/modules:
  + Updated nginx-upload-progress module, Thanks to upstream for fixing issue
    that FTBFS nginx on kFreeBSD-* archs.
  + Updated nginx-lua module to latest upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
449
449
{
450
450
    ngx_str_t                                   *id, *oldid;
451
451
    ngx_slab_pool_t                             *shpool;
452
 
    ngx_connection_t                            *c;
453
452
    ngx_shm_zone_t                              *shm_zone;
454
453
    ngx_http_uploadprogress_ctx_t               *ctx;
455
454
    ngx_http_uploadprogress_node_t              *up;
458
457
 
459
458
    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "upload-progress: ngx_http_uploadprogress_event_handler");
460
459
    
461
 
    c = r->connection;
462
 
 
463
460
    /* find node, update rest */
464
461
    oldid = id = get_tracking_id(r);
465
462
 
675
672
/*
676
673
 There are 4 possibilities
677
674
   * request not yet started: found = false
678
 
   * request in error:        err_status >= NGX_HTTP_SPECIAL_RESPONSE
 
675
   * request in error:        err_status >= NGX_HTTP_BAD_REQUEST
679
676
   * request finished:        done = true
680
677
   * request not yet started but registered:        length==0 && rest ==0
681
678
   * reauest in progress:     rest > 0 
683
680
 
684
681
    if (!found) {
685
682
        state = uploadprogress_state_starting;
686
 
    } else if (err_status >= NGX_HTTP_SPECIAL_RESPONSE) {
 
683
    } else if (err_status >= NGX_HTTP_BAD_REQUEST) {
687
684
        state = uploadprogress_state_error;
688
685
    } else if (done) {
689
686
        state = uploadprogress_state_done;
1007
1004
    ngx_http_uploadprogress_cleanup_t *upcln = data;
1008
1005
    ngx_slab_pool_t                 *shpool;
1009
1006
    ngx_rbtree_node_t               *node;
1010
 
    ngx_http_uploadprogress_ctx_t   *ctx;
1011
1007
    ngx_http_uploadprogress_node_t  *up;
1012
1008
    ngx_http_request_t              *r;
1013
1009
 
1014
1010
    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, upcln->shm_zone->shm.log, 0,
1015
1011
                   "uploadprogress cleanup called");
1016
1012
 
1017
 
    ctx = upcln->shm_zone->data;
1018
1013
    shpool = (ngx_slab_pool_t *) upcln->shm_zone->shm.addr;
1019
1014
    node = upcln->node;
1020
1015
    r = upcln->r;
1165
1160
        node->key = hash;
1166
1161
        up->len = (u_char) id->len;
1167
1162
        up->err_status = r->err_status;
 
1163
        up->done = 0;
 
1164
        up->rest = 0;
 
1165
        up->length = 0;
 
1166
        up->timeout = 0;
 
1167
 
1168
1168
        ngx_memcpy(up->data, id->data, id->len);
1169
1169
 
1170
1170
        up->next = ctx->list_head.next;
1235
1235
ngx_http_uploadprogress_create_loc_conf(ngx_conf_t * cf)
1236
1236
{
1237
1237
    ngx_http_uploadprogress_conf_t  *conf;
1238
 
    ngx_http_uploadprogress_template_t   *t;
1239
1238
    ngx_uint_t                            i;
1240
1239
 
1241
1240
    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_uploadprogress_conf_t));
1247
1246
        return NGX_CONF_ERROR;
1248
1247
    }
1249
1248
 
1250
 
    t = conf->templates.elts;
1251
1249
    for(i = 0;i < conf->templates.nalloc; i++) {
1252
1250
        ngx_http_uploadprogress_template_t *elt = ngx_array_push(&conf->templates);
1253
1251
        if (elt == NULL) {
1307
1305
ngx_http_uploadprogress_init_variables_and_templates(ngx_conf_t *cf)
1308
1306
{
1309
1307
    ngx_http_variable_t  *var, *v;
1310
 
    ngx_http_uploadprogress_template_t   *t;
1311
1308
    ngx_http_uploadprogress_state_map_t  *m;
1312
 
    ssize_t                               n;
1313
1309
    ngx_uint_t                            i;
1314
1310
 
1315
1311
    /* Add variables */
1330
1326
    }
1331
1327
 
1332
1328
    m = ngx_http_uploadprogress_state_map;
1333
 
    t = ngx_http_uploadprogress_global_templates.elts;
1334
1329
    i = 0;
1335
1330
 
1336
1331
    while(m->name.data != NULL) {
1337
1332
        ngx_http_uploadprogress_template_t *elt = ngx_array_push(&ngx_http_uploadprogress_global_templates);
1338
 
        n = ngx_http_script_variables_count(ngx_http_uploadprogress_java_defaults + i);
 
1333
        ngx_http_script_variables_count(ngx_http_uploadprogress_java_defaults + i);
1339
1334
 
1340
1335
        if (ngx_http_upload_progress_set_template(cf, elt, ngx_http_uploadprogress_java_defaults + i) != NGX_CONF_OK) {
1341
1336
            return NGX_ERROR;