Skip to content

Commit

Permalink
Merge r1429559, r1451484 from trunk:
Browse files Browse the repository at this point in the history
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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1455223 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Jim Jagielski committed Mar 11, 2013
1 parent bec4b54 commit 7814fba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
7 changes: 0 additions & 7 deletions STATUS
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down
17 changes: 9 additions & 8 deletions modules/ssl/ssl_util_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 7814fba

Please sign in to comment.