~ubuntu-branches/debian/stretch/haproxy/stretch

« back to all changes in this revision

Viewing changes to src/cfgparse.c

  • Committer: Package Import Robot
  • Author(s): Vincent Bernat
  • Date: 2015-05-02 16:38:28 UTC
  • mfrom: (1.3.13)
  • Revision ID: package-import@ubuntu.com-20150502163828-lph2toctaqrw41x5
Tags: 1.5.12-1
* New upstream stable release including the following fixes:
  - BUG/MAJOR: http: don't read past buffer's end in http_replace_value
  - BUG/MAJOR: http: prevent risk of reading past end with balance
               url_param
  - BUG/MEDIUM: Do not consider an agent check as failed on L7 error
  - BUG/MEDIUM: patern: some entries are not deleted with case
                insensitive match
  - BUG/MEDIUM: buffer: one byte miss in buffer free space check
  - BUG/MEDIUM: http: thefunction "(req|res)-replace-value" doesn't
                respect the HTTP syntax
  - BUG/MEDIUM: peers: correctly configure the client timeout
  - BUG/MEDIUM: http: hdr_cnt would not count any header when called
                without name
  - BUG/MEDIUM: listener: don't report an error when resuming unbound
                listeners
  - BUG/MEDIUM: init: don't limit cpu-map to the first 32 processes only
  - BUG/MEDIUM: stream-int: always reset si->ops when si->end is
                nullified
  - BUG/MEDIUM: http: remove content-length from chunked messages
  - BUG/MEDIUM: http: do not restrict parsing of transfer-encoding to
                HTTP/1.1
  - BUG/MEDIUM: http: incorrect transfer-coding in the request is a bad
                request
  - BUG/MEDIUM: http: remove content-length form responses with bad
                transfer-encoding
  - BUG/MEDIUM: http: wait for the exact amount of body bytes in
                wait_for_request_body

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
        { "contstats",    PR_O_CONTSTATS,  PR_CAP_FE, 0, 0 },
152
152
        { "dontlognull",  PR_O_NULLNOLOG,  PR_CAP_FE, 0, 0 },
153
153
        { "http_proxy",   PR_O_HTTP_PROXY, PR_CAP_FE | PR_CAP_BE, 0, PR_MODE_HTTP },
 
154
        { "http-ignore-probes", PR_O_IGNORE_PRB, PR_CAP_FE, 0, PR_MODE_HTTP },
154
155
        { "prefer-last-server", PR_O_PREF_LAST,  PR_CAP_BE, 0, PR_MODE_HTTP },
155
156
        { "logasap",      PR_O_LOGASAP,    PR_CAP_FE, 0, 0 },
156
157
        { "nolinger",     PR_O_TCP_NOLING, PR_CAP_FE | PR_CAP_BE, 0, 0 },
1743
1744
                curpeers->conf.line = linenum;
1744
1745
                curpeers->last_change = now.tv_sec;
1745
1746
                curpeers->id = strdup(args[1]);
 
1747
                curpeers->state = PR_STNEW;
1746
1748
        }
1747
1749
        else if (strcmp(args[0], "peer") == 0) { /* peer definition */
1748
1750
                struct sockaddr_storage *sk;
1834
1836
                                curpeers->peers_fe->cap = PR_CAP_FE;
1835
1837
                                curpeers->peers_fe->maxconn = 0;
1836
1838
                                curpeers->peers_fe->conn_retries = CONN_RETRIES;
1837
 
                                curpeers->peers_fe->timeout.connect = 5000;
 
1839
                                curpeers->peers_fe->timeout.client = MS_TO_TICKS(5000);
1838
1840
                                curpeers->peers_fe->accept = peer_accept;
1839
1841
                                curpeers->peers_fe->options2 |= PR_O2_INDEPSTR | PR_O2_SMARTCON | PR_O2_SMARTACC;
1840
1842
                                curpeers->peers_fe->conf.args.file = curpeers->peers_fe->conf.file = strdup(file);
1875
1877
                        }
1876
1878
                }
1877
1879
        } /* neither "peer" nor "peers" */
 
1880
        else if (!strcmp(args[0], "disabled")) {  /* disables this peers section */
 
1881
                curpeers->state = PR_STSTOPPED;
 
1882
        }
 
1883
        else if (!strcmp(args[0], "enabled")) {  /* enables this peers section (used to revert a disabled default) */
 
1884
                curpeers->state = PR_STNEW;
 
1885
        }
1878
1886
        else if (*args[0] != 0) {
1879
1887
                Alert("parsing [%s:%d] : unknown keyword '%s' in '%s' section\n", file, linenum, args[0], cursection);
1880
1888
                err_code |= ERR_ALERT | ERR_FATAL;
6107
6115
                if (curproxy->state == PR_STSTOPPED) {
6108
6116
                        /* ensure we don't keep listeners uselessly bound */
6109
6117
                        stop_proxy(curproxy);
 
6118
                        free((void *)curproxy->table.peers.name);
 
6119
                        curproxy->table.peers.p = NULL;
6110
6120
                        continue;
6111
6121
                }
6112
6122
 
6524
6534
                                curproxy->table.peers.p = NULL;
6525
6535
                                cfgerr++;
6526
6536
                        }
 
6537
                        else if (curpeers->state == PR_STSTOPPED) {
 
6538
                                /* silently disable this peers section */
 
6539
                                curproxy->table.peers.p = NULL;
 
6540
                        }
6527
6541
                        else if (!curpeers->peers_fe) {
6528
6542
                                Alert("Proxy '%s': unable to find local peer '%s' in peers section '%s'.\n",
6529
6543
                                      curproxy->id, localpeer, curpeers->id);
7366
7380
                }
7367
7381
        }
7368
7382
 
7369
 
        /* initialize stick-tables on backend capable proxies. This must not
7370
 
         * be done earlier because the data size may be discovered while parsing
7371
 
         * other proxies.
7372
 
         */
7373
 
        for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
7374
 
                if (curproxy->state == PR_STSTOPPED)
7375
 
                        continue;
7376
 
 
7377
 
                if (!stktable_init(&curproxy->table)) {
7378
 
                        Alert("Proxy '%s': failed to initialize stick-table.\n", curproxy->id);
7379
 
                        cfgerr++;
7380
 
                }
7381
 
        }
7382
 
 
7383
7383
        /*
7384
7384
         * Recount currently required checks.
7385
7385
         */
7407
7407
                last = &peers;
7408
7408
                while (*last) {
7409
7409
                        curpeers = *last;
7410
 
                        if (curpeers->peers_fe) {
 
7410
 
 
7411
                        if (curpeers->state == PR_STSTOPPED) {
 
7412
                                /* the "disabled" keyword was present */
 
7413
                                if (curpeers->peers_fe)
 
7414
                                        stop_proxy(curpeers->peers_fe);
 
7415
                                curpeers->peers_fe = NULL;
 
7416
                        }
 
7417
                        else if (!curpeers->peers_fe) {
 
7418
                                Warning("Removing incomplete section 'peers %s' (no peer named '%s').\n",
 
7419
                                        curpeers->id, localpeer);
 
7420
                        }
 
7421
                        else {
7411
7422
                                last = &curpeers->next;
7412
7423
                                continue;
7413
7424
                        }
7414
7425
 
7415
 
                        Warning("Removing incomplete section 'peers %s' (no peer named '%s').\n",
7416
 
                                curpeers->id, localpeer);
7417
 
 
 
7426
                        /* clean what has been detected above */
7418
7427
                        p = curpeers->remote;
7419
7428
                        while (p) {
7420
7429
                                pb = p->next;
7433
7442
                }
7434
7443
        }
7435
7444
 
 
7445
        /* initialize stick-tables on backend capable proxies. This must not
 
7446
         * be done earlier because the data size may be discovered while parsing
 
7447
         * other proxies.
 
7448
         */
 
7449
        for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
 
7450
                if (curproxy->state == PR_STSTOPPED)
 
7451
                        continue;
 
7452
 
 
7453
                if (!stktable_init(&curproxy->table)) {
 
7454
                        Alert("Proxy '%s': failed to initialize stick-table.\n", curproxy->id);
 
7455
                        cfgerr++;
 
7456
                }
 
7457
        }
 
7458
 
7436
7459
        pool2_hdr_idx = create_pool("hdr_idx",
7437
7460
                                    global.tune.max_http_hdr * sizeof(struct hdr_idx_elem),
7438
7461
                                    MEM_F_SHARED);