You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2021/09/09 07:06:01 UTC

svn commit: r1893164 - in /httpd/httpd/trunk: include/http_ssl.h server/ssl.c

Author: icing
Date: Thu Sep  9 07:06:00 2021
New Revision: 1893164

URL: http://svn.apache.org/viewvc?rev=1893164&view=rev
Log:
  *core: clarify comments and use hook API better to check for presence of callbacks.


Modified:
    httpd/httpd/trunk/include/http_ssl.h
    httpd/httpd/trunk/server/ssl.c

Modified: httpd/httpd/trunk/include/http_ssl.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_ssl.h?rev=1893164&r1=1893163&r2=1893164&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_ssl.h (original)
+++ httpd/httpd/trunk/include/http_ssl.h Thu Sep  9 07:06:00 2021
@@ -56,13 +56,14 @@ AP_DECLARE(int) ap_ssl_conn_is_ssl(conn_
  * This hook can be called several times in the lifetime of an outgoing connection, e.g.
  * when it is re-used in different request contexts. It will at least be called after the
  * connection was created and before the pre-connection hooks is invoked.
- * All outgoing-connection hooks are run until one returns something other than ok or decline.
- * if enable_ssl != 0, a hook that sets up SSL for the connection needs to return DONE.
+ * All outgoing-connection hooks are run until one returns something other than DECLINE.
+ * if enable_ssl != 0, a hook that sets up SSL for the connection needs to return OK
+ * to prevent subsequent hooks from doing the same.
  *
  * @param c The connection on which requests/data are to be sent.
  * @param dir_conf The directory configuration in which this connection is being used.
  * @param enable_ssl If != 0, the SSL protocol should be enabled for this connection.
- * @return OK or DECLINED, DONE when ssl was enabled
+ * @return DECLINED, OK when ssl was enabled
  */
 AP_DECLARE_HOOK(int, ssl_bind_outgoing,
                (conn_rec *c, struct ap_conf_vector_t *dir_conf, int enable_ssl))

Modified: httpd/httpd/trunk/server/ssl.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/ssl.c?rev=1893164&r1=1893163&r2=1893164&view=diff
==============================================================================
--- httpd/httpd/trunk/server/ssl.c (original)
+++ httpd/httpd/trunk/server/ssl.c Thu Sep  9 07:06:00 2021
@@ -157,7 +157,7 @@ AP_DECLARE(int) ap_ssl_bind_outgoing(con
 
 AP_DECLARE(int) ap_ssl_has_outgoing_handlers(void)
 {
-    return (_hooks.link_ssl_bind_outgoing && _hooks.link_ssl_bind_outgoing->nelts > 0)
+    return (ap_hook_get_ssl_bind_outgoing() && ap_hook_get_ssl_bind_outgoing()->nelts > 0)
         || module_ssl_engine_set || module_ssl_proxy_enable;
 }
 



Re: svn commit: r1893164 - in /httpd/httpd/trunk: include/http_ssl.h server/ssl.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Thu, Sep 9, 2021 at 9:06 AM <ic...@apache.org> wrote:
>
>  AP_DECLARE(int) ap_ssl_has_outgoing_handlers(void)
>  {
> -    return (_hooks.link_ssl_bind_outgoing && _hooks.link_ssl_bind_outgoing->nelts > 0)
> +    return (ap_hook_get_ssl_bind_outgoing() && ap_hook_get_ssl_bind_outgoing()->nelts > 0)
>          || module_ssl_engine_set || module_ssl_proxy_enable;
>  }

Use a var?

    apr_array_header_t *a = ap_hook_get_ssl_bind_outgoing();
    return (a && a->nelts > 0) || ...;

Cheers;
Yann.