Browse Source

UpdateCertificateErrors counter

Source commit: 4d3c5d1e5f276355f65659c0a07d47b4a4add95f
Martin Prikryl 9 years ago
parent
commit
4723f96539
3 changed files with 22 additions and 5 deletions
  1. 5 0
      source/core/Http.cpp
  2. 1 0
      source/core/Http.h
  3. 16 5
      source/windows/Setup.cpp

+ 5 - 0
source/core/Http.cpp

@@ -241,3 +241,8 @@ int THttp::NeonServerSSLCallbackImpl(int Failures, const ne_ssl_certificate * Ce
   return (Failures == 0) ? NE_OK : NE_ERROR;
 }
 //---------------------------------------------------------------------------
+bool THttp::IsCertificateError()
+{
+  return !FCertificateError.IsEmpty();
+}
+//---------------------------------------------------------------------------

+ 1 - 0
source/core/Http.h

@@ -20,6 +20,7 @@ public:
 
   void Get();
   void Post(const UnicodeString & Request);
+  bool IsCertificateError();
 
   __property UnicodeString URL = { read = FURL, write = FURL };
   __property UnicodeString ProxyHost = { read = FProxyHost, write = FProxyHost };

+ 16 - 5
source/windows/Setup.cpp

@@ -892,15 +892,26 @@ static bool __fastcall DoQueryUpdates(TUpdatesConfiguration & Updates, bool Coll
     CheckForUpdatesHTTP->URL = URL;
     // sanity check
     CheckForUpdatesHTTP->ResponseLimit = 102400;
-    if (CollectUsage)
+    try
     {
-      UnicodeString Usage = GetUsageData();
+      if (CollectUsage)
+      {
+        UnicodeString Usage = GetUsageData();
 
-      CheckForUpdatesHTTP->Post(Usage);
+        CheckForUpdatesHTTP->Post(Usage);
+      }
+      else
+      {
+        CheckForUpdatesHTTP->Get();
+      }
     }
-    else
+    catch (...)
     {
-      CheckForUpdatesHTTP->Get();
+      if (CheckForUpdatesHTTP->IsCertificateError())
+      {
+        Configuration->Usage->Inc(L"UpdateCertificateErrors");
+      }
+      throw;
     }
     Response = CheckForUpdatesHTTP->Response;
   }