build_module: fixed building on RHEL/CentOS 7 and Amazon Linux.
These platforms have quite old Python which doesn't work with SNI.
diff --git a/build_module.sh b/build_module.sh
index 2c96877..f53887f 100755
--- a/build_module.sh
+++ b/build_module.sh
@@ -358,7 +358,17 @@
#
echo "$ME: INFO: Downloading NGINX packaging tool"
cd $BUILD_DIR
-hg clone https://hg.nginx.org/pkg-oss
+
+PKG_OSS_URL="https://hg.nginx.org/pkg-oss"
+
+if [ "$PKG_FMT" = "rpm" ]; then
+ if [ `rpm --eval "0%{?rhel}"` -lt 8 ] || [ `rpm --eval "0%{?amzn}"` -le 2 ]; then
+ PKG_OSS_URL="http://hg.nginx.org/pkg-oss"
+ fi
+fi
+
+hg clone $PKG_OSS_URL
+
if [ "$BUILD_PLATFORM" = "OSS" ]; then
if [ "$OSS_VER" != "" ]; then
( cd pkg-oss && hg update `hg tags | grep "^$OSS_VER" | head -1 | awk '{print $1}'` )