]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: http_ana: Make use of the return value of stream_generate_unique_id()
authorTim Duesterhus <tim@bastelstu.be>
Tue, 17 May 2022 22:22:15 +0000 (00:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 18 May 2022 05:19:01 +0000 (07:19 +0200)
Even if `unique_id` and `s->unique_id` are identical it is a bit odd to
`isttest()` `unique_id` and then use `s->unique_id` in the call to `http_add_header()`.

This "issue" was introduced in a17e66289c08a5bfadc1bb5b5f2c618c9299fe1b,
because before that commit the function returned the length of the ID, as it
was not an ist.

src/http_ana.c
src/stream.c

index c18d0764dc50be49659e1d55f2c5e71ab932a653..faa2d239d81457caf85ff8cbe4a4438bbce6ec75 100644 (file)
@@ -653,7 +653,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
 
                /* send unique ID if a "unique-id-header" is defined */
                if (isttest(sess->fe->header_unique_id) &&
-                   unlikely(!http_add_header(htx, sess->fe->header_unique_id, s->unique_id)))
+                   unlikely(!http_add_header(htx, sess->fe->header_unique_id, unique_id)))
                                goto return_int_err;
        }
 
index 29d1a60b56169aa58a4aa1f4212ff16490691313..d18031e4130d4ba5d546848611c10f67807372c4 100644 (file)
@@ -2850,7 +2850,7 @@ INITCALL0(STG_INIT, init_stream);
 
 /* Generates a unique ID based on the given <format>, stores it in the given <strm> and
  * returns the unique ID.
-
+ *
  * If this function fails to allocate memory IST_NULL is returned.
  *
  * If an ID is already stored within the stream nothing happens existing unique ID is