From 2fdc24c1097955c5d2c88a9cc0be66069b22eebe Mon Sep 17 00:00:00 2001 From: Scott Giese Date: Thu, 7 Feb 2019 01:26:05 -0600 Subject: [PATCH] METAR fix --- src/Environment/realwx_ctrl.cxx | 4 ++-- src/Main/metar_main.cxx | 4 ++-- utils/fgcom/utils/build_fgcom_server.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Environment/realwx_ctrl.cxx b/src/Environment/realwx_ctrl.cxx index a1133830e..f7a42f098 100644 --- a/src/Environment/realwx_ctrl.cxx +++ b/src/Environment/realwx_ctrl.cxx @@ -426,7 +426,7 @@ void NoaaMetarRealWxController::requestMetar ) { static const std::string NOAA_BASE_URL = - "http://tgftp.nws.noaa.gov/data/observations/metar/stations/"; + "https://tgftp.nws.noaa.gov/data/observations/metar/stations/"; class NoaaMetarGetRequest: public simgear::HTTP::MemoryRequest { @@ -443,7 +443,7 @@ void NoaaMetarRealWxController::requestMetar virtual void onDone() { - if( responseCode() != 200 ) + if( responseCode() >= 400 ) { SG_LOG ( diff --git a/src/Main/metar_main.cxx b/src/Main/metar_main.cxx index 657a7d9e4..7a0bd148c 100644 --- a/src/Main/metar_main.cxx +++ b/src/Main/metar_main.cxx @@ -539,7 +539,7 @@ int main(int argc, char *argv[]) try { static const std::string NOAA_BASE_URL = - "http://tgftp.nws.noaa.gov/data/observations/metar/stations/"; + "https://tgftp.nws.noaa.gov/data/observations/metar/stations/"; HTTP::MemoryRequest* mr = new HTTP::MemoryRequest ( NOAA_BASE_URL + strutils::uppercase(argv[i]) + ".TXT" @@ -558,7 +558,7 @@ int main(int argc, char *argv[]) if( !mr->isComplete() ) throw sg_io_exception("metar download timed out"); - if( mr->responseCode() != 200 ) + if( mr->responseCode() >= 400 ) { std::cerr << "metar download failed: " << mr->url() diff --git a/utils/fgcom/utils/build_fgcom_server.sh b/utils/fgcom/utils/build_fgcom_server.sh index 8fdbbae37..c71247062 100644 --- a/utils/fgcom/utils/build_fgcom_server.sh +++ b/utils/fgcom/utils/build_fgcom_server.sh @@ -6,7 +6,7 @@ APTNAV_DATA="http://dev.x-plane.com/update/data/AptNav201304XP1000.zip" DAHDI_SRC="http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz" LOGSEP="###########################################" GETMETAR_SCRIPT="#!/bin/bash -#curl http://tgftp.nws.noaa.gov/data/observations/metar/stations/$1.TXT +#curl https://tgftp.nws.noaa.gov/data/observations/metar/stations/$1.TXT echo \"Hello World !\"" ROOT=$PWD