You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2013/03/11 17:34:19 UTC

svn commit: r1455223 - in /httpd/httpd/branches/2.4.x: ./ STATUS modules/ssl/ssl_util_ssl.c

Author: jim
Date: Mon Mar 11 16:34:19 2013
New Revision: 1455223

URL: http://svn.apache.org/r1455223
Log:
Merge r1429559, r1451484 from trunk:

According top my testing 'SSL_SESSION_id2sz' is 4x faster with the use 'ap_bin2hex' instead of
apr_snprintf(..., "%02X" for each character.
Output is the same.

I have left the uppercase conversion, because I'm unsure if it is usefull or not.

SSL_SESSION_id2sz is only used for logging, having it in lowercase shouldn't be an issue.
Submitted by: jailletc36
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/modules/ssl/ssl_util_ssl.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1429559,1451484

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1455223&r1=1455222&r2=1455223&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Mon Mar 11 16:34:19 2013
@@ -116,13 +116,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
     2.4.x patch: trunk patches apply (minus CHANGES for 1448171)
     2.4.x cumulative patch: http://people.apache.org/~jailletc36/backport5.patch (minus CHANGES for 1448171)
     +1: jailletc36, igalic, jim
-
-  * ssl_util_ssl: Speed up logging function by x4 using ap_bin2hex intoduced in 2.4.4
-    It will be in lowercase instead of uppercase, but it is only for logging. I don't think this is a real issue.
-    trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1429559
-                 http://svn.apache.org/viewvc?view=revision&revision=1451484
-    2.4.x patch: trunk patch applies with offset.
-    +1: jailletc36, humbedooh, jim
     
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

Modified: httpd/httpd/branches/2.4.x/modules/ssl/ssl_util_ssl.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/ssl/ssl_util_ssl.c?rev=1455223&r1=1455222&r2=1455223&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/ssl/ssl_util_ssl.c (original)
+++ httpd/httpd/branches/2.4.x/modules/ssl/ssl_util_ssl.c Mon Mar 11 16:34:19 2013
@@ -479,14 +479,15 @@ int SSL_CTX_use_certificate_chain(
 char *SSL_SESSION_id2sz(unsigned char *id, int idlen,
                         char *str, int strsize)
 {
-    char *cp;
-    int n;
+    if (idlen > SSL_MAX_SSL_SESSION_ID_LENGTH)
+        idlen = SSL_MAX_SSL_SESSION_ID_LENGTH;
+        
+    /* We must ensure not to process more than what would fit in the
+     * destination buffer, including terminating NULL */
+    if (idlen > (strsize-1) / 2)
+        idlen = (strsize-1) / 2;
+
+    ap_bin2hex(id, idlen, str);
 
-    cp = str;
-    for (n = 0; n < idlen && n < SSL_MAX_SSL_SESSION_ID_LENGTH; n++) {
-        apr_snprintf(cp, strsize - (cp-str), "%02X", id[n]);
-        cp += 2;
-    }
-    *cp = NUL;
     return str;
 }