~ubuntu-branches/ubuntu/oneiric/nginx/oneiric-updates

« back to all changes in this revision

Viewing changes to src/http/ngx_http_request_body.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-11-28 08:38:27 UTC
  • mfrom: (4.2.24 sid)
  • Revision ID: james.westby@ubuntu.com-20101128083827-yxc30ucpllbu3h08
Tags: 0.8.53-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - Don't copy the default site directly into /var/www/ in the package,
    but instead keep it in /usr/share/nginx/nginx-default and move it to
   /var/www/nginx-default/ just after installation. (LP: #547267)
* debian/patches/nginx-html5-codecs.diff
  - Add support for html5 codecs (LP: #674224)

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r);
14
14
static ngx_int_t ngx_http_write_request_body(ngx_http_request_t *r,
15
15
    ngx_chain_t *body);
16
 
static void ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r);
17
16
static ngx_int_t ngx_http_read_discarded_request_body(ngx_http_request_t *r);
18
17
static ngx_int_t ngx_http_test_expect(ngx_http_request_t *r);
19
18
 
37
36
    ngx_http_request_body_t   *rb;
38
37
    ngx_http_core_loc_conf_t  *clcf;
39
38
 
 
39
    r->main->count++;
 
40
 
40
41
    if (r->request_body || r->discard_body) {
41
42
        post_handler(r);
42
43
        return NGX_OK;
468
469
        }
469
470
    }
470
471
 
471
 
    r->discard_body = 1;
472
 
 
473
 
    r->read_event_handler = ngx_http_read_discarded_request_body_handler;
 
472
    r->read_event_handler = ngx_http_discarded_request_body_handler;
474
473
 
475
474
    if (ngx_handle_read_event(rev, 0) != NGX_OK) {
476
475
        return NGX_HTTP_INTERNAL_SERVER_ERROR;
477
476
    }
478
477
 
479
 
    (void) ngx_http_read_discarded_request_body(r);
 
478
    if (ngx_http_read_discarded_request_body(r) == NGX_OK) {
 
479
        r->lingering_close = 0;
 
480
 
 
481
    } else {
 
482
        r->count++;
 
483
        r->discard_body = 1;
 
484
    }
480
485
 
481
486
    return NGX_OK;
482
487
}
483
488
 
484
489
 
485
 
static void
486
 
ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r)
 
490
void
 
491
ngx_http_discarded_request_body_handler(ngx_http_request_t *r)
487
492
{
488
493
    ngx_int_t                  rc;
489
494
    ngx_msec_t                 timer;
497
502
    if (rev->timedout) {
498
503
        c->timedout = 1;
499
504
        c->error = 1;
500
 
        ngx_http_finalize_request(r, 0);
 
505
        ngx_http_finalize_request(r, NGX_ERROR);
501
506
        return;
502
507
    }
503
508
 
506
511
 
507
512
        if (timer <= 0) {
508
513
            r->discard_body = 0;
509
 
            ngx_http_finalize_request(r, 0);
 
514
            r->lingering_close = 0;
 
515
            ngx_http_finalize_request(r, NGX_ERROR);
510
516
            return;
511
517
        }
512
518
 
517
523
    rc = ngx_http_read_discarded_request_body(r);
518
524
 
519
525
    if (rc == NGX_OK) {
520
 
 
521
526
        r->discard_body = 0;
522
 
 
523
 
        if (r->done) {
524
 
            ngx_http_finalize_request(r, 0);
525
 
        }
526
 
 
 
527
        r->lingering_close = 0;
 
528
        ngx_http_finalize_request(r, NGX_DONE);
527
529
        return;
528
530
    }
529
531
 
531
533
 
532
534
    if (ngx_handle_read_event(rev, 0) != NGX_OK) {
533
535
        c->error = 1;
534
 
        ngx_http_finalize_request(r, rc);
 
536
        ngx_http_finalize_request(r, NGX_ERROR);
535
537
        return;
536
538
    }
537
539