From 69bab6971c8a9a9922e422bda6546053a5e0cb8f Mon Sep 17 00:00:00 2001 From: David Freese Date: Tue, 9 Apr 2013 09:07:51 -0500 Subject: [PATCH] WX parser * Update station name parser iaw new METAR format --- src/misc/weather.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/misc/weather.cxx b/src/misc/weather.cxx index ff823915..77801992 100644 --- a/src/misc/weather.cxx +++ b/src/misc/weather.cxx @@ -238,13 +238,14 @@ void getwx(string& wx, const char *metar) LOG_WARN("%s", "station not found\n"); return; } - const char *eoh = "Connection: close"; + const char *eoh = "Content-Type:"; p1 = text.find(eoh); if (p1 != string::npos) { - text.erase(0, p1 + strlen(eoh) + 4); + p1 = text.find("\n",p1); + text.erase(0, p1); + while (text[0] == '\r' || text[0] == '\n') text.erase(0,1); p1 = text.find("\n"); - if (p1 != string::npos) - name = text.substr(0, p1); + name = text.substr(0, p1); } p3 = text.find("ob:");