Commit graph

8 commits

Author SHA1 Message Date
Ebrahim Byagowi ef6ff77539 Avoid use of deprecated URL related global functions
Change-Id: I752d77c6c23f0cf8598d3759c73df29cd385652d
2024-09-09 09:50:19 +03:30
thiemowmde e5df1df69e Lazy load large domains.php file only when it's really needed
I have seen this popping up once in a recent flame graph. I think most
services should be designed in a way that they can be instantiated
very quickly and only start doing expensive stuff when we are sure we
really need it. This was not the case here. The file domains.php is
about 150,000 lines long and can take several 100ms to load in the
worst case.

Bug: T200758
Change-Id: I7c0c787230e8cff40e8e73fede0ac1dce63ea1ca
2023-06-14 22:19:40 -04:00
Umherirrender f49dab01a1 Improve performance of string operation on domain lookup
The benchLookup.php shows that the lookups take half the time as before,
without more memory

In the lookup use offsets instead of preg_replace to create the smaller
strings, also simplify the return

In the hook handler use str_starts_with to check start of string,
strpos needs to scan the whole string for a negative check,
but we need only need information about the begin

Bug: T316443
Change-Id: Ibc0cbe5f7f14bd56d4e126fa7ed183a807d9a99c
2022-08-27 19:35:03 +00:00
Kunal Mehta 0509d34225 Switch to new hook handler format
* Turn HSTSPreloadLookup into a real service, per @todo
* Convert Hooks into a non-static class, take lookup as an argument
* Update tests for new calling style

== Test plan ==
* CI/tests pass
* Use Special:ExpandTemplates with a preloaded domain and localhost,
  observe preloaded link changes, localhost stays http

Bug: T271027
Change-Id: I0196350e85c09eedfba4dbf1dab81f9a757b2a12
2022-06-05 12:12:39 -04:00
Kunal Mehta dfa2506116 Update Legoktm's email address
Change-Id: Ic20c6d24d221fd5377bfa4a36a7f0ee034fad9e1
2021-04-11 19:10:07 -07:00
Kunal Mehta 6ac715971e Fix weird spacing
I'm not sure why I did this

Change-Id: I86302d8c1e6f619f9493c1779714cb905a0b526b
2018-08-01 21:40:16 -07:00
Kunal Mehta f0ed5222ff Refactor out a HSTSPreloadLookup class plus tests
Makes it much easier to write tests, and do potential further
refactoring.

Change-Id: I072951bb2bc87639e076d03c233f7283c0b175ff
2018-08-01 21:23:49 -07:00
Kunal Mehta e436b78837 Initial commit
Change-Id: I2c8efb613632ce785580e8fba4da5b0a3a36a0f6
2018-07-29 19:01:06 -07:00