Commit 1d2b9ac2 authored by Paul Querna's avatar Paul Querna
Browse files

Merge the listen-protocol sandbox branch to trunk.

I will be adding documentation for the new directives hopefully in the next day or so.

* server/core.c: Added 'Protocol' to the core module config
                 Added ap_{set,get}_server_protocol API.
                 Added new directive: 'AcceptFilter'.
                 Enable 'httpready' by default on systems that support it.  Use dataready filters for others.

* server/listen.c: Attempt to inherit protocols from Listener Records to Server configs.
                   The 'Listen' directive can now optionally take a protocol arg
                   Move bits that determined which accept filter is applied to core.c.
                   Added bits to find the correct accept filter based on the core's configuration.

* include/{ap_listen.h,http_core.h}: Add Protocol to respective structures.

* include/http_core.h: Add the accf_map table to the core_server_config structure

* include/ap_mmn.h: Minor MMN Bump for the new interfacces.

* modules/ssl/ssl_engine_init.c: Use the new protocol framework to enable mod_ssl for 'https' websites.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190563 13f79535-47bb-0310-9956-ffa450edef68
parent b0a8b40f
Loading
Loading
Loading
Loading
+8 −0
Changes for CHANGES: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,14 @@ Changes with Apache 2.1.5
  [Remove entries to the current 2.0 section below, when backported]
  *) mod_ssl: Setting the Protocol to 'https' can replace the use of the 
     'SSLEngine on' command. [Paul Querna]
  *) core: Refactor the mapping of Accept Filters to Sockets. Add the 
     AcceptFilter and Protocol directives to aid in mapping filter types.
     Extend the Listen directive to optionally take a protocol name.
     [Paul Querna]
  *) mod_disk_cache: Support storing multiple variations of one URL. PR 35211.
     [Paul Querna]
+8 −4
Changes for include/ap_listen.h: 8 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -53,7 +53,10 @@ struct ap_listen_rec {
     * Is this socket currently active 
     */
    int active;
/* more stuff here, like which protocol is bound to the port */
    /**
     * The default protocol for this listening socket.
     */
    const char* protocol;
};

/**
@@ -82,7 +85,8 @@ AP_DECLARE(int) ap_setup_listeners(server_rec *s);
 * called.
 */ 
AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg);
AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy, const char *ips);
AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy, 
                                                int argc, char *const argv[]);
AP_DECLARE_NONSTD(const char *) ap_set_send_buffer_size(cmd_parms *cmd, void *dummy,
				    const char *arg);
AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
@@ -92,8 +96,8 @@ AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
#define LISTEN_COMMANDS	\
AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \
  "Maximum length of the queue of pending connections, as used by listen(2)"), \
AP_INIT_TAKE1("Listen", ap_set_listener, NULL, RSRC_CONF, \
  "A port number or a numeric IP address and a port number"), \
AP_INIT_TAKE_ARGV("Listen", ap_set_listener, NULL, RSRC_CONF, \
  "A port number or a numeric IP address and a port number, and an optional protocol"), \
AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
  "Send buffer size in bytes"), \
AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
+2 −1
Changes for include/ap_mmn.h: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@
 * 20050305.0 (2.1.4-dev) added pid and generation fields to worker_score
 * 20050305.1 (2.1.5-dev) added ap_vhost_iterate_given_conn.
 * 20050305.2 (2.1.5-dev) added AP_INIT_TAKE_ARGV.
 * 20050305.3 (2.1.5-dev) added Protocol Framework.
 */

#define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
@@ -102,7 +103,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20050305
#endif
#define MODULE_MAGIC_NUMBER_MINOR 2                     /* 0...n */
#define MODULE_MAGIC_NUMBER_MINOR 3                     /* 0...n */

/**
 * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
+5 −0
Changes for include/http_core.h: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -548,6 +548,9 @@ typedef struct {
    /* recursion backstopper */
    int redirect_limit; /* maximum number of internal redirects */
    int subreq_limit;   /* maximum nesting level of subrequests */

    const char *protocol;
    apr_table_t *accf_map;
} core_server_config;

/* for AddOutputFiltersByType in core.c */
@@ -573,6 +576,8 @@ apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);

#endif /* CORE_PRIVATE */

AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);

/* ----------------------------------------------------------------------
 *
+6 −1
Changes for modules/ssl/ssl_engine_init.c: 6 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -207,6 +207,10 @@ int ssl_init_Module(apr_pool_t *p, apr_pool_t *plog,
        sc->vhost_id = ssl_util_vhostid(p, s);
        sc->vhost_id_len = strlen(sc->vhost_id);

        if (strcmp("https", ap_get_server_protocol(s)) == 0) {
            sc->enabled = SSL_ENABLED_TRUE;
        }

       /* If sc->enabled is UNSET, then SSL is optional on this vhost  */
        /* Fix up stuff that may not have been set */
        if (sc->enabled == SSL_ENABLED_UNSET) {
@@ -879,7 +883,8 @@ static void ssl_init_server_certs(server_rec *s,

    if (!(have_rsa || have_dsa)) {
        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
                "Oops, no RSA or DSA server certificate found?!");
                "Oops, no RSA or DSA server certificate found "
                "for '%s:%d'?!", s->server_hostname, s->port);
        ssl_die();
    }

Loading