Closed summercms closed 2 years ago
Link: https://github.com/WhichBrowser/Parser-PHP/blob/master/data/applications-bots.php#L386
/^curl\/([0-9.]*)/u
Currently the regex is as above. Straight away I see some issues with the regex.
It's only detecting curl at the beginning using the ^
curl
^
It only detecting lower case.
It would be better to change the code to the following:
/curl\/([0-9.]*)/ui
The above then will match:
curl Curl cURL
Some things to note. The curl regex is near the bottom of the application-bots.php file. So regex like the following:
application-bots.php
serpstatbot/1.0 (advanced backlink tracking bot; curl/7.58.0; http://serpstatbot.com/; abuse@serpstatbot.com)
Should find serpstatbot/1.0 before curl/7.58.0 and mark it up correctly. Which it does with the following test location:
serpstatbot/1.0
curl/7.58.0
https://github.com/WhichBrowser/Parser-PHP/blob/master/tests/data/bots/generic.yaml#L722
Below are some common UA's from the internet:
Have cherry picked some to add to the tests folder with this pr.
tests
Coverage remained the same at 100.0% when pulling 0ba75d9d871780b7aa6f70ea818e10c18d6f4351 on ayumi-cloud:curl into da24adc4f4f26002673d236e69b91a10f2fd594c on WhichBrowser:master.
Link: https://github.com/WhichBrowser/Parser-PHP/blob/master/data/applications-bots.php#L386
Currently the regex is as above. Straight away I see some issues with the regex.
It's only detecting
curl
at the beginning using the^
It only detecting lower case.
It would be better to change the code to the following:
The above then will match:
Some things to note. The
curl
regex is near the bottom of theapplication-bots.php
file. So regex like the following:Should find
serpstatbot/1.0
beforecurl/7.58.0
and mark it up correctly. Which it does with the following test location:https://github.com/WhichBrowser/Parser-PHP/blob/master/tests/data/bots/generic.yaml#L722
Below are some common UA's from the internet:
Have cherry picked some to add to the
tests
folder with this pr.