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

svn commit: r1892982 - in /httpd/httpd/branches/2.4.x: ./ changes-entries/Reduce_time_window_for_duplicate_in_uniqueid.txt modules/metadata/mod_unique_id.c

Author: ylavic
Date: Mon Sep  6 10:53:04 2021
New Revision: 1892982

URL: http://svn.apache.org/viewvc?rev=1892982&view=rev
Log:
Merge r1892915 from trunk:

Reduce the time window where duplicates may be generated by mod_uniqueid

Submitted by: jailletc36
Reviewed by: jailletc36, jorton, icing

Added:
    httpd/httpd/branches/2.4.x/changes-entries/Reduce_time_window_for_duplicate_in_uniqueid.txt
      - copied unchanged from r1892915, httpd/httpd/trunk/changes-entries/Reduce_time_window_for_duplicate_in_uniqueid.txt
Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/modules/metadata/mod_unique_id.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1892915

Modified: httpd/httpd/branches/2.4.x/modules/metadata/mod_unique_id.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/metadata/mod_unique_id.c?rev=1892982&r1=1892981&r2=1892982&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/metadata/mod_unique_id.c (original)
+++ httpd/httpd/branches/2.4.x/modules/metadata/mod_unique_id.c Mon Sep  6 10:53:04 2021
@@ -186,7 +186,7 @@ static const char *gen_unique_id(const r
 {
     char *str;
     /*
-     * Buffer padded with two final bytes, used to copy the unique_id_red
+     * Buffer padded with two final bytes, used to copy the unique_id_rec
      * structure without the internal paddings that it could have.
      */
     unique_id_rec new_unique_id;
@@ -199,9 +199,13 @@ static const char *gen_unique_id(const r
     int i,j,k;
 
     memcpy(&new_unique_id.root, &cur_unique_id.root, ROOT_SIZE);
-    new_unique_id.counter = cur_unique_id.counter;
     new_unique_id.stamp = htonl((unsigned int)apr_time_sec(r->request_time));
     new_unique_id.thread_index = htonl((unsigned int)r->connection->id);
+    new_unique_id.counter = cur_unique_id.counter;
+
+    /* Increment the identifier for the next call */
+    counter = ntohs(new_unique_id.counter) + 1;
+    cur_unique_id.counter = htons(counter);
 
     /* we'll use a temporal buffer to avoid uuencoding the possible internal
      * paddings of the original structure */
@@ -233,11 +237,6 @@ static const char *gen_unique_id(const r
     }
     str[k++] = '\0';
 
-    /* and increment the identifier for the next call */
-
-    counter = ntohs(new_unique_id.counter) + 1;
-    cur_unique_id.counter = htons(counter);
-
     return str;
 }