~ubuntu-branches/ubuntu/trusty/lighttpd/trusty

« back to all changes in this revision

Viewing changes to src/connections.c

  • Committer: Package Import Robot
  • Author(s): Mattia Rizzolo
  • Date: 2013-10-30 15:52:50 UTC
  • mfrom: (6.1.22 sid)
  • Revision ID: package-import@ubuntu.com-20131030155250-wp6wen9r2g7wc020
Tags: 1.4.33-1ubuntu1
* Merge from Debian unstable (LP: #1246886).  Remaining changes:
  - debian/index.html: corrected BTS Ubuntu link for lighttpd.
  - debian/index.html: s/Debian/Ubuntu/g branding on the default page.
  - debian/lighttpd.conf: Comment 'use-ipv6.pl' by default, which causes
    failure to bind port in ipv4.
  - Add lighttpd-dev package:
    + debian/control: Added lighttpd-dev package; Build-depends on
      automake (>=1.14), libtool.
    + debian/lighttpd-dev.install: Added.
  - debian/control: libgamin-dev rather than libfam-dev to fix startup warning.
  - debian/rules: Add override_dh_installinit to set "defaults 91 09" to not
    start before apache2 but in the same runlevel with the same priority.
  - Added a UFW profile set:
    + debian/lighttpd.dirs: added etc/ufw/applications.d
    + debian/rules: install the ufw profile.
    + debian/control: Suggests on ufw.
  - debian/patches/build-dev-package.patch: Updated to reflect 1.4.33 changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
200
200
        int r, ssl_err, len, count = 0, read_offset, toread;
201
201
        buffer *b = NULL;
202
202
 
203
 
        if (!con->conf.is_ssl) return -1;
 
203
        if (!con->srv_socket->is_ssl) return -1;
204
204
 
205
205
        ERR_clear_error();
206
206
        do {
224
224
                len = SSL_read(con->ssl, b->ptr + read_offset, toread);
225
225
 
226
226
                if (con->renegotiations > 1 && con->conf.ssl_disable_client_renegotiation) {
 
227
                        log_error_write(srv, __FILE__, __LINE__, "s", "SSL: renegotiation initiated by client, killing connection");
227
228
                        connection_set_state(srv, con, CON_STATE_ERROR);
228
 
                        log_error_write(srv, __FILE__, __LINE__, "s", "SSL: renegotiation initiated by client");
229
229
                        return -1;
230
230
                }
231
231
 
334
334
        buffer *b;
335
335
        int toread, read_offset;
336
336
 
337
 
        if (con->conf.is_ssl) {
 
337
        if (con->srv_socket->is_ssl) {
338
338
                return connection_handle_read_ssl(srv, con);
339
339
        }
340
340
 
419
419
                case HTTP_METHOD_GET:
420
420
                case HTTP_METHOD_POST:
421
421
                case HTTP_METHOD_HEAD:
422
 
                case HTTP_METHOD_PUT:
423
 
                case HTTP_METHOD_MKCOL:
424
 
                case HTTP_METHOD_DELETE:
425
 
                case HTTP_METHOD_COPY:
426
 
                case HTTP_METHOD_MOVE:
427
 
                case HTTP_METHOD_PROPFIND:
428
 
                case HTTP_METHOD_PROPPATCH:
429
 
                case HTTP_METHOD_LOCK:
430
 
                case HTTP_METHOD_UNLOCK:
431
422
                        break;
432
423
                case HTTP_METHOD_OPTIONS:
433
424
                        /*
449
440
                        }
450
441
                        break;
451
442
                default:
452
 
                        switch(con->http_status) {
453
 
                        case 400: /* bad request */
454
 
                        case 401: /* authorization required */
455
 
                        case 414: /* overload request header */
456
 
                        case 505: /* unknown protocol */
457
 
                        case 207: /* this was webdav */
458
 
                                break;
459
 
                        default:
 
443
                        if (0 == con->http_status) {
460
444
                                con->http_status = 501;
461
 
                                break;
462
445
                        }
463
446
                        break;
464
447
                }
693
676
        CLEAN(physical.etag);
694
677
        CLEAN(parse_request);
695
678
 
696
 
        CLEAN(authed_user);
697
679
        CLEAN(server_name);
698
680
        CLEAN(error_handler);
699
681
        CLEAN(dst_addr_buf);
760
742
                CLEAN(physical.rel_path);
761
743
                CLEAN(parse_request);
762
744
 
763
 
                CLEAN(authed_user);
764
745
                CLEAN(server_name);
765
746
                CLEAN(error_handler);
766
747
                CLEAN(dst_addr_buf);
834
815
 
835
816
        CLEAN(parse_request);
836
817
 
837
 
        CLEAN(authed_user);
838
818
        CLEAN(server_name);
839
819
        CLEAN(error_handler);
840
820
#if defined USE_OPENSSL && ! defined OPENSSL_NO_TLSEXT
1191
1171
 
1192
1172
        joblist_append(srv, con);
1193
1173
 
1194
 
        if (con->conf.is_ssl) {
 
1174
        if (con->srv_socket->is_ssl) {
1195
1175
                /* ssl may read and write for both reads and writes */
1196
1176
                if (revents & (FDEVENT_IN | FDEVENT_OUT)) {
1197
1177
                        con->is_readable = 1;
1362
1342
                        con->renegotiations = 0;
1363
1343
                        SSL_set_app_data(con->ssl, con);
1364
1344
                        SSL_set_accept_state(con->ssl);
1365
 
                        con->conf.is_ssl=1;
1366
1345
 
1367
1346
                        if (1 != (SSL_set_fd(con->ssl, cnt))) {
1368
1347
                                log_error_write(srv, __FILE__, __LINE__, "ss", "SSL:",
1407
1386
 
1408
1387
                        connection_set_state(srv, con, CON_STATE_READ);
1409
1388
 
1410
 
                        /* patch con->conf.is_ssl if the connection is a ssl-socket already */
1411
 
 
1412
 
#ifdef USE_OPENSSL
1413
 
                        con->conf.is_ssl = srv_sock->is_ssl;
1414
 
#endif
1415
 
 
1416
1389
                        break;
1417
1390
                case CON_STATE_REQUEST_END: /* transient */
1418
1391
                        if (srv->srvconf.log_state_handling) {
1712
1685
                                                                                ERR_error_string(err, NULL));
1713
1686
                                                        } while((err = ERR_get_error()));
1714
1687
                                                } else if (errno != 0) { /* ssl bug (see lighttpd ticket #2213): sometimes errno == 0 */
1715
 
                                                        log_error_write(srv, __FILE__, __LINE__, "sddds", "SSL (error):",
 
1688
                                                        switch(errno) {
 
1689
                                                        case EPIPE:
 
1690
                                                        case ECONNRESET:
 
1691
                                                                break;
 
1692
                                                        default:
 
1693
                                                                log_error_write(srv, __FILE__, __LINE__, "sddds", "SSL (error):",
1716
1694
                                                                        ssl_r, ret, errno,
1717
1695
                                                                        strerror(errno));
 
1696
                                                                break;
 
1697
                                                        }
1718
1698
                                                }
1719
 
        
 
1699
 
1720
1700
                                                break;
1721
1701
                                        default:
1722
1702
                                                while((err = ERR_get_error())) {
1724
1704
                                                                        ssl_r, ret,
1725
1705
                                                                        ERR_error_string(err, NULL));
1726
1706
                                                }
1727
 
        
 
1707
 
1728
1708
                                                break;
1729
1709
                                        }
1730
1710
                                }
 
1711
                                ERR_clear_error();
1731
1712
                        }
1732
 
                        ERR_clear_error();
1733
1713
#endif
1734
1714
 
1735
1715
                        switch(con->mode) {