ddos protection does not allow downloads in CLI

50 views
Skip to first unread message

D. Tschinder

unread,
Nov 27, 2017, 5:38:20 AM11/27/17
to browscap
Since Monday midnight we are not able to automatically download the browscap.ini files from the website (we do so once a day around midnight)

```
wget https://browscap.org/stream\?q\=PHP_BrowsCapINI
--2017-11-27 11:29:52-- https://browscap.org/stream?q=PHP_BrowsCapINI
Resolving browscap.org... 104.28.17.219, 104.28.16.219, 2400:cb00:2048:1::681c:10db, ...
Connecting to browscap.org|104.28.17.219|:443... connected.
HTTP request sent, awaiting response... 503 Service Temporarily Unavailable
2017-11-27 11:29:52 ERROR 503: Service Temporarily Unavailable.
```
When I try this in the browser it works fine, but on the command line it does not work.

So I assume this is because of the ddos protection, which I saw when accessing the page in my browser.

How should we download the ini file now? Or is this a temporary issue?

James Titcumb

unread,
Nov 27, 2017, 5:53:59 AM11/27/17
to browscap
Hi there,

This is a temporary issue until the end of the month - see my response on https://github.com/browscap/browscap-php/issues/228

Also, it's worth pointing out that you don't need to download it once a day; please check that the version hasn't changed first, at most we update the files once a month.. so you're just wasting bandwidth by downloading the whole thing daily ;)

Thanks
James

Henning Verbeek

unread,
Nov 27, 2017, 7:14:56 AM11/27/17
to browscap
On Monday, November 27, 2017 at 11:53:59 AM UTC+1, James Titcumb wrote:
> Also, it's worth pointing out that you don't need to download it once a day; please check that the version hasn't changed first, at most we update the files once a month.. so you're just wasting bandwidth by downloading the whole thing daily ;)

Unfortunately, checking the version number fails with HTTP 503...

James Titcumb

unread,
Nov 27, 2017, 7:16:18 AM11/27/17
to browscap
Well yes, it will do, until I turn it off... I meant during "normal" service :)

Thanks
James

D. Tschinder

unread,
Nov 27, 2017, 8:46:48 AM11/27/17
to browscap
Thanks for the clarification.

I change our script now to do this, in order to correctly check the latest version. Maybe an easy example should be posted on the website on how to correctly do this.

git checkout master && git pull
current_version=$( awk -F "=" '$1=="Version" {print $2;exit;}' config/php_browscap.ini);
latest_version=$(curl https://browscap.org/version-number --fail)

if [[ -z "${latest_version// }" ]]; then
echo "Cannot request latest version";
exit;
fi

if [[ "${current_version// }" != "${latest_version// }" ]]; then
wget http://browscap.org/stream?q=PHP_BrowsCapINI -O config/php_browscap.ini && git status && git add . && (git commit -m "Update lite_php_browscap.ini" || echo "BUILD: nothing to commit") && git pull && git push
else
echo "No newer version available";
fi


Even better would be a small bash script/client that people can use to download the latest version if not yet downloaded. Something like:

browscap_downloader path/to/browscap.ini --version PHP_BrowsCapINI

James Titcumb

unread,
Nov 27, 2017, 8:49:11 AM11/27/17
to browscap
We already have a supported PHP libary that does this: https://github.com/browscap/browscap-php - hopefully that helps!

Thanks
James
Reply all
Reply to author
Forward
0 new messages