Browse Source

Bug 1615: HTTP proxy responses for FTP protocol are logged char by char

https://winscp.net/tracker/1615

Source commit: 4876bff8d2717c92cf8aa09db5c45ca75156bbf5
Martin Prikryl 7 năm trước cách đây
mục cha
commit
a9e301f376
1 tập tin đã thay đổi với 11 bổ sung3 xóa
  1. 11 3
      source/filezilla/AsyncProxySocketLayer.cpp

+ 11 - 3
source/filezilla/AsyncProxySocketLayer.cpp

@@ -453,6 +453,7 @@ void CAsyncProxySocketLayer::OnReceive(int nErrorCode)
   {
     DebugAssert(m_nProxyOpID==PROXYOP_CONNECT);
     char buffer[9]={0};
+    bool responseLogged = false;
     for(;;)
     {
       int numread = ReceiveNext(buffer, m_pStrBuffer?1:8);
@@ -491,9 +492,13 @@ void CAsyncProxySocketLayer::OnReceive(int nErrorCode)
       char *pos = strstr(m_pStrBuffer, "\r\n");
       if (pos)
       {
-        CString status;
-        status.Format(L"HTTP proxy response: %s", UnicodeString(m_pStrBuffer).c_str());
-        LogSocketMessageRaw(FZ_LOG_PROGRESS, status);
+        if (!responseLogged)
+        {
+          CString status;
+          status.Format(L"HTTP proxy response: %s", UnicodeString(m_pStrBuffer, pos - m_pStrBuffer).c_str());
+          LogSocketMessageRaw(FZ_LOG_PROGRESS, status);
+          responseLogged = true;
+        }
         char *pos2 = strstr(m_pStrBuffer, " ");
         if (!pos2 || *(pos2+1)!='2' || pos2>pos)
         {
@@ -506,6 +511,9 @@ void CAsyncProxySocketLayer::OnReceive(int nErrorCode)
       }
       if (strlen(m_pStrBuffer)>3 && !memcmp(m_pStrBuffer+strlen(m_pStrBuffer)-4, "\r\n\r\n", 4)) //End of the HTTP header
       {
+        CString status;
+        status.Format(L"HTTP proxy headers: %s", UnicodeString(pos).c_str());
+        LogSocketMessageRaw(FZ_LOG_PROGRESS, status);
         ConnectionEstablished();
         return;
       }