Query var normalization should be hardened to avoid infinite space #1467
Labels
[Plugin] Optimization Detective
Issues for the Optimization Detective plugin
[Type] Enhancement
A suggestion for improvement of an existing feature
The
post_name
for anod_url_metrics
post is comprised of an MD5-hash (viaod_get_url_metrics_slug()
) of the normalized query vars as returned byod_get_normalized_query_vars()
. The normalization is done to avoid creating moreod_url_metrics
posts than are needed.For example, when a 404 is returned the URL could contain anything. A request for
/?p=123456789
results in query vars includingarray( 'p' => 123456789 )
even when the post doesn't exist. Every 404 response should be the same, so there is no need to have separateod_url_metrics
posts for each 404 response. (In fact,is_404()
should perhaps be included in the conditions used byod_can_optimize_response()
. This is already the case for search queries (whenis_search()
), since the URL space for searches is by definition unconstrained.) But the situation gets complicated with other types or archive queries. For example,hour
,minute
, andsecond
are all valid public query vars to get posts by date. Or you can addtag
andcat
query vars with arbitrary comma-separated lists of tags and categories to create more possible permutations of query vars that will result in unique slug for anod_url_metrics
post. How should this be handled?Aside: I just realized that
od_get_normalized_query_vars()
isn't sorting the array keys, which is also needed for normalization.The text was updated successfully, but these errors were encountered: