Sfoglia il codice sorgente

Improving HTTP error reporting

Source commit: 5960b633e486c4a8e2d05a1246c89b2120754a06
Martin Prikryl 2 anni fa
parent
commit
52cec785ee
2 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 3 0
      source/core/NeonIntf.cpp
  2. 4 2
      source/core/Security.cpp

+ 3 - 0
source/core/NeonIntf.cpp

@@ -207,6 +207,9 @@ void CheckNeonStatus(ne_session * Session, int NeonStatus,
       }
     }
 
+    UnicodeString LogError(Error);
+    AddToList(LogError, NeonError, sLineBreak);
+    AppLogFmt(L"HTTP request failed: %s", (LogError));
     throw ExtException(Error, NeonError);
   }
 }

+ 4 - 2
source/core/Security.cpp

@@ -217,11 +217,13 @@ bool WindowsValidateCertificate(const unsigned char * Certificate, size_t Len, U
         }
         else
         {
+          int PolicyError = PolicyStatus.dwError;
           // Windows thinks the certificate is valid.
-          Result = (PolicyStatus.dwError == S_OK);
+          Result = (PolicyError == S_OK);
           if (!Result)
           {
-            Error = FORMAT(L"Error: %x, Chain index: %d, Element index: %d", (PolicyStatus.dwError, PolicyStatus.lChainIndex, PolicyStatus.lElementIndex));
+            UnicodeString ErrorStr = SysErrorMessage(PolicyError);
+            Error = FORMAT(L"Error: %x (%s), Chain index: %d, Element index: %d", (PolicyError, ErrorStr, PolicyStatus.lChainIndex, PolicyStatus.lElementIndex));
           }
         }