View | Details | Raw Unified | Return to bug 35702
Collapse All | Expand All

(-)httpd-2.1.6-alpha/support/ab.c (-34 / +42 lines)
Lines 80-85 Link Here
80
   **     Switched to the new abstract pollset API, allowing ab to
80
   **     Switched to the new abstract pollset API, allowing ab to
81
   **     take advantage of future apr_pollset_t scalability improvements.
81
   **     take advantage of future apr_pollset_t scalability improvements.
82
   **     Contributed by Brian Pane, August 31, 2002
82
   **     Contributed by Brian Pane, August 31, 2002
83
   **
84
   ** Version 2.1.7-dev
85
   **     New SSL code by Masaoki Kobayashi <masaoki@techfirm.co.jp>,
86
   **     enables the asynchronous I/O also under SSL connections.
83
   **/
87
   **/
84
88
85
/* Note: this version string should start with \d+[\d\.]* and be a valid
89
/* Note: this version string should start with \d+[\d\.]* and be a valid
Lines 91-97 Link Here
91
 * ab - or to due to a change in the distribution it is compiled with 
95
 * ab - or to due to a change in the distribution it is compiled with 
92
 * (such as an APR change in for example blocking).
96
 * (such as an APR change in for example blocking).
93
 */
97
 */
94
#define AP_AB_BASEREVISION "2.0.40-dev"    
98
#define AP_AB_BASEREVISION "2.1.7-dev"    
95
99
96
/*
100
/*
97
 * BUGS:
101
 * BUGS:
Lines 234-239 Link Here
234
    int socknum;
238
    int socknum;
235
#ifdef USE_SSL
239
#ifdef USE_SSL
236
    SSL *ssl;
240
    SSL *ssl;
241
    int ssl_polling;
237
#endif
242
#endif
238
};
243
};
239
244
Lines 403-413 Link Here
403
                   (w & SSL_CB_READ ? "read" : "write"),
408
                   (w & SSL_CB_READ ? "read" : "write"),
404
                   SSL_alert_type_string_long(r),
409
                   SSL_alert_type_string_long(r),
405
                   SSL_alert_desc_string_long(r));
410
                   SSL_alert_desc_string_long(r));
406
    } else if (w & SSL_CB_LOOP) {
411
    }
412
    else if (w & SSL_CB_LOOP) {
407
        BIO_printf(bio_err, "SSL/TLS State [%s] %s\n",
413
        BIO_printf(bio_err, "SSL/TLS State [%s] %s\n",
408
                   (SSL_in_connect_init((SSL*)s) ? "connect" : "-"),
414
                   (SSL_in_connect_init((SSL*)s) ? "connect" : "-"),
409
                   SSL_state_string_long(s));
415
                   SSL_state_string_long(s));
410
    } else if (w & (SSL_CB_HANDSHAKE_START|SSL_CB_HANDSHAKE_DONE)) {
416
    }
417
    else if (w & (SSL_CB_HANDSHAKE_START|SSL_CB_HANDSHAKE_DONE)) {
411
        BIO_printf(bio_err, "SSL/TLS Handshake [%s] %s\n",
418
        BIO_printf(bio_err, "SSL/TLS Handshake [%s] %s\n",
412
                   (w & SSL_CB_HANDSHAKE_START ? "Start" : "Done"),
419
                   (w & SSL_CB_HANDSHAKE_START ? "Start" : "Done"),
413
                   SSL_state_string_long(s));
420
                   SSL_state_string_long(s));
Lines 528-534 Link Here
528
    cert = SSL_get_peer_certificate(c->ssl);
535
    cert = SSL_get_peer_certificate(c->ssl);
529
    if (cert == NULL) {
536
    if (cert == NULL) {
530
        BIO_printf(bio_out, "Anon DH\n");
537
        BIO_printf(bio_out, "Anon DH\n");
531
    } else {
538
    }
539
    else {
532
        BIO_printf(bio_out, "Peer certificate\n");
540
        BIO_printf(bio_out, "Peer certificate\n");
533
        ssl_print_cert_info(bio_out, cert);
541
        ssl_print_cert_info(bio_out, cert);
534
        X509_free(cert);
542
        X509_free(cert);
Lines 543-549 Link Here
543
551
544
    while (do_next) {
552
    while (do_next) {
545
        int ret, ecode;
553
        int ret, ecode;
546
        apr_pollfd_t new_pollfd;
547
554
548
        ret = SSL_do_handshake(c->ssl);
555
        ret = SSL_do_handshake(c->ssl);
549
        ecode = SSL_get_error(c->ssl, ret);
556
        ecode = SSL_get_error(c->ssl, ret);
Lines 575-585 Link Here
575
            do_next = 0;
582
            do_next = 0;
576
            break;
583
            break;
577
        case SSL_ERROR_WANT_READ:
584
        case SSL_ERROR_WANT_READ:
578
            new_pollfd.desc_type = APR_POLL_SOCKET;
585
            if (!c->ssl_polling) {
579
            new_pollfd.reqevents = APR_POLLIN;
586
                apr_pollfd_t new_pollfd;
580
            new_pollfd.desc.s = c->aprsock;
587
                new_pollfd.desc_type = APR_POLL_SOCKET;
581
            new_pollfd.client_data = c;
588
                new_pollfd.reqevents = APR_POLLIN;
582
            apr_pollset_add(readbits, &new_pollfd);
589
                new_pollfd.desc.s = c->aprsock;
590
                new_pollfd.client_data = c;
591
                apr_pollset_add(readbits, &new_pollfd);
592
                c->ssl_polling = 1;
593
            }
583
            do_next = 0;
594
            do_next = 0;
584
            break;
595
            break;
585
        case SSL_ERROR_WANT_WRITE:
596
        case SSL_ERROR_WANT_WRITE:
Lines 666-671 Link Here
666
    totalposted += c->rwrite;
677
    totalposted += c->rwrite;
667
    c->state = STATE_READ;
678
    c->state = STATE_READ;
668
    c->endwrite = apr_time_now();
679
    c->endwrite = apr_time_now();
680
#ifdef USE_SSL
681
    /* Do not add the pollset here in ssl connection which is
682
       already been polling */
683
    if (!c->ssl_polling)
684
#endif
669
    {
685
    {
670
        apr_pollfd_t new_pollfd;
686
        apr_pollfd_t new_pollfd;
671
        new_pollfd.desc_type = APR_POLL_SOCKET;
687
        new_pollfd.desc_type = APR_POLL_SOCKET;
Lines 1135-1140 Link Here
1135
            ERR_print_errors(bio_err);
1151
            ERR_print_errors(bio_err);
1136
            exit(1);
1152
            exit(1);
1137
        }
1153
        }
1154
        c->ssl_polling = 0;
1138
        ssl_rand_seed();
1155
        ssl_rand_seed();
1139
        apr_os_sock_get(&fd, c->aprsock);
1156
        apr_os_sock_get(&fd, c->aprsock);
1140
        bio = BIO_new_socket(fd, BIO_NOCLOSE);
1157
        bio = BIO_new_socket(fd, BIO_NOCLOSE);
Lines 1144-1151 Link Here
1144
            BIO_set_callback(bio, ssl_print_cb);
1161
            BIO_set_callback(bio, ssl_print_cb);
1145
            BIO_set_callback_arg(bio, bio_err);
1162
            BIO_set_callback_arg(bio, bio_err);
1146
        }
1163
        }
1147
    } else {
1164
    }
1165
    else {
1148
        c->ssl = NULL;
1166
        c->ssl = NULL;
1167
        c->ssl_polling = 0;
1149
    }
1168
    }
1150
#endif
1169
#endif
1151
    if ((rv = apr_socket_connect(c->aprsock, destsa)) != APR_SUCCESS) {
1170
    if ((rv = apr_socket_connect(c->aprsock, destsa)) != APR_SUCCESS) {
Lines 1184-1190 Link Here
1184
#ifdef USE_SSL
1203
#ifdef USE_SSL
1185
    if (c->ssl) {
1204
    if (c->ssl) {
1186
        ssl_proceed_handshake(c);
1205
        ssl_proceed_handshake(c);
1187
    } else
1206
    }
1207
    else
1188
#endif
1208
#endif
1189
    {
1209
    {
1190
        write_request(c);
1210
        write_request(c);
Lines 1693-1714 Link Here
1693
                    write_request(c);
1713
                    write_request(c);
1694
                }
1714
                }
1695
            }
1715
            }
1696
    
1697
            /*
1698
             * When using a select based poll every time we check the bits
1699
             * are reset. In 1.3's ab we copied the FD_SET's each time
1700
             * through, but here we're going to check the state and if the
1701
             * connection is in STATE_READ or STATE_CONNECTING we'll add the
1702
             * socket back in as APR_POLLIN.
1703
             */
1704
                if (c->state == STATE_READ) {
1705
                    apr_pollfd_t new_pollfd;
1706
                    new_pollfd.desc_type = APR_POLL_SOCKET;
1707
                    new_pollfd.reqevents = APR_POLLIN;
1708
                    new_pollfd.desc.s = c->aprsock;
1709
                    new_pollfd.client_data = c;
1710
                    apr_pollset_add(readbits, &new_pollfd);
1711
                }
1712
        }
1716
        }
1713
    }
1717
    }
1714
1718
Lines 1729-1742 Link Here
1729
static void copyright(void)
1733
static void copyright(void)
1730
{
1734
{
1731
    if (!use_html) {
1735
    if (!use_html) {
1732
        printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.146 $> apache-2.0");
1736
        printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " apache-2.1");
1733
        printf("Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
1737
        printf("Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
1734
        printf("Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/\n");
1738
        printf("Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/\n");
1735
        printf("\n");
1739
        printf("\n");
1736
    }
1740
    }
1737
    else {
1741
    else {
1738
        printf("<p>\n");
1742
        printf("<p>\n");
1739
        printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.146 $");
1743
        printf(" This is ApacheBench, Version %s apache-2.1<br>\n", AP_AB_BASEREVISION);
1740
        printf(" Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
1744
        printf(" Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
1741
        printf(" Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/<br>\n");
1745
        printf(" Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/<br>\n");
1742
        printf("</p>\n<p>\n");
1746
        printf("</p>\n<p>\n");
Lines 1852-1858 Link Here
1852
         (port != 80)))
1856
         (port != 80)))
1853
    {
1857
    {
1854
        colonhost = apr_psprintf(cntxt,":%d",port);
1858
        colonhost = apr_psprintf(cntxt,":%d",port);
1855
    } else
1859
    }
1860
    else
1856
        colonhost = "";
1861
        colonhost = "";
1857
    return 0;
1862
    return 0;
1858
}
1863
}
Lines 2082-2092 Link Here
2082
            case 'f':
2087
            case 'f':
2083
                if (strncasecmp(optarg, "ALL", 3) == 0) {
2088
                if (strncasecmp(optarg, "ALL", 3) == 0) {
2084
                    meth = SSLv23_client_method();
2089
                    meth = SSLv23_client_method();
2085
                } else if (strncasecmp(optarg, "SSL2", 4) == 0) {
2090
                }
2091
                else if (strncasecmp(optarg, "SSL2", 4) == 0) {
2086
                    meth = SSLv2_client_method();
2092
                    meth = SSLv2_client_method();
2087
                } else if (strncasecmp(optarg, "SSL3", 4) == 0) {
2093
                }
2094
                else if (strncasecmp(optarg, "SSL3", 4) == 0) {
2088
                    meth = SSLv3_client_method();
2095
                    meth = SSLv3_client_method();
2089
                } else if (strncasecmp(optarg, "TLS1", 4) == 0) {
2096
                }
2097
                else if (strncasecmp(optarg, "TLS1", 4) == 0) {
2090
                    meth = TLSv1_client_method();
2098
                    meth = TLSv1_client_method();
2091
                }
2099
                }
2092
                break;
2100
                break;

Return to bug 35702