Le 21/11/2019 à 16:54, William Dauchy a écrit :
On Tue, Nov 19, 2019 at 04:35:47PM +0100, Christopher Faulet wrote:
+/* Parse the query stirng of request URI to filter the metrics. It returns 1 on
+ * success and -1 on error. */
+static int promex_parse_uri(struct appctx *appctx, struct stream_interface *si)
+ struct channel *req = si_oc(si);
+ struct channel *res = si_ic(si);
+ struct htx *req_htx, *res_htx;
+ struct htx_sl *sl;
+ const char *p, *end;
+ struct buffer *err;
+ int default_scopes = PROMEX_FL_SCOPE_ALL;
+ int len;
+ /* Get the query-string */
+ req_htx = htxbuf(&req->buf);
+ sl = http_get_stline(req_htx);
+ if (!sl)
+ goto error;
+ p = http_find_param_list(HTX_SL_REQ_UPTR(sl), HTX_SL_REQ_ULEN(sl), '?');
+ if (!p)
+ goto end;
It's my turn to be sorry. I wrongly tested on my side regarding a real
integration with prometheus, because I mixed the old metrics and the new
ones. Indeed, prometheus is trying to scrape the encoded url such as:
For the record, I report here our private conversation.
URI delimiters must not be encoded, except if you want to escape it. So, your
first url is not equivalent to the second one. The encoded question mark is part
of the path in the first url, it is not the query-string delimiter.
But, cause of your remark, I re-read the function code and it revealed a bug.
The query-string is decoded before parsing. Only parameters names and values
must be decoded. Thus, a fix is still required.