~ubuntu-branches/ubuntu/trusty/haproxy/trusty

« back to all changes in this revision

Viewing changes to src/proto_http.c

  • Committer: Bazaar Package Importer
  • Author(s): Christo Buschek
  • Date: 2011-07-14 18:17:05 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20110714181705-ixi2giijqc61cqjm
Tags: 1.4.15-1
New upstream release with critical bug fix (Closes: #631351)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4317
4317
        }
4318
4318
 
4319
4319
        while (1) {
 
4320
                int bytes;
 
4321
 
4320
4322
                http_silent_debug(__LINE__, s);
4321
4323
                /* we may have some data pending */
4322
 
                if (msg->chunk_len || msg->som != msg->sov) {
4323
 
                        int bytes = msg->sov - msg->som;
4324
 
                        if (bytes < 0) /* sov may have wrapped at the end */
 
4324
                bytes = msg->sov - msg->som;
 
4325
                if (msg->chunk_len || bytes) {
 
4326
                        msg->som = msg->sov;
 
4327
                        if (likely(bytes < 0)) /* sov may have wrapped at the end */
4325
4328
                                bytes += req->size;
4326
 
                        buffer_forward(req, bytes + msg->chunk_len);
4327
 
                        msg->chunk_len = 0; /* don't forward that again */
4328
 
                        msg->som = msg->sov;
 
4329
                        msg->chunk_len += (unsigned int)bytes;
 
4330
                        msg->chunk_len -= buffer_forward(req, msg->chunk_len);
4329
4331
                }
4330
4332
 
4331
4333
                if (msg->msg_state == HTTP_MSG_DATA) {
5307
5309
{
5308
5310
        struct http_txn *txn = &s->txn;
5309
5311
        struct http_msg *msg = &s->txn.rsp;
 
5312
        int bytes;
5310
5313
 
5311
5314
        if (unlikely(msg->msg_state < HTTP_MSG_BODY))
5312
5315
                return 0;
5339
5342
        }
5340
5343
 
5341
5344
        while (1) {
 
5345
                int bytes;
 
5346
 
5342
5347
                http_silent_debug(__LINE__, s);
5343
5348
                /* we may have some data pending */
5344
 
                if (msg->chunk_len || msg->som != msg->sov) {
5345
 
                        int bytes = msg->sov - msg->som;
5346
 
                        if (bytes < 0) /* sov may have wrapped at the end */
 
5349
                bytes = msg->sov - msg->som;
 
5350
                if (msg->chunk_len || bytes) {
 
5351
                        msg->som = msg->sov;
 
5352
                        if (likely(bytes < 0)) /* sov may have wrapped at the end */
5347
5353
                                bytes += res->size;
5348
 
                        buffer_forward(res, bytes + msg->chunk_len);
5349
 
                        msg->chunk_len = 0; /* don't forward that again */
5350
 
                        msg->som = msg->sov;
 
5354
                        msg->chunk_len += (unsigned int)bytes;
 
5355
                        msg->chunk_len -= buffer_forward(res, msg->chunk_len);
5351
5356
                }
5352
5357
 
 
5358
 
5353
5359
                if (msg->msg_state == HTTP_MSG_DATA) {
5354
5360
                        /* must still forward */
5355
5361
                        if (res->to_forward)
5454
5460
        if (!s->req->analysers)
5455
5461
                goto return_bad_res;
5456
5462
 
5457
 
        /* forward the chunk size as well as any pending data */
5458
 
        if (msg->chunk_len || msg->som != msg->sov) {
5459
 
                int bytes = msg->sov - msg->som;
5460
 
                if (bytes < 0) /* sov may have wrapped at the end */
 
5463
        /* forward any pending data */
 
5464
        bytes = msg->sov - msg->som;
 
5465
        if (msg->chunk_len || bytes) {
 
5466
                msg->som = msg->sov;
 
5467
                if (likely(bytes < 0)) /* sov may have wrapped at the end */
5461
5468
                        bytes += res->size;
5462
 
                buffer_forward(res, msg->sov - msg->som + msg->chunk_len);
5463
 
                msg->chunk_len = 0; /* don't forward that again */
5464
 
                msg->som = msg->sov;
 
5469
                msg->chunk_len += (unsigned int)bytes;
 
5470
                msg->chunk_len -= buffer_forward(res, msg->chunk_len);
5465
5471
        }
5466
5472
 
5467
5473
        /* the session handler will take care of timeouts and errors */
6825
6831
                                hdr_end      += stripped_before;
6826
6832
                                hdr_next     += stripped_before;
6827
6833
                                cur_hdr->len += stripped_before;
6828
 
                                http_msg_move_end(&txn->req, stripped_before);
 
6834
                                http_msg_move_end(&txn->rsp, stripped_before);
6829
6835
                        }
6830
6836
 
6831
6837
                        /* First, let's see if we want to capture this cookie. We check