浏览代码

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

https://winscp.net/tracker/1615

Source commit: 4876bff8d2717c92cf8aa09db5c45ca75156bbf5
Martin Prikryl 7 年之前
父节点
当前提交
a9e301f376
共有 1 个文件被更改,包括 11 次插入3 次删除
  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);
     DebugAssert(m_nProxyOpID==PROXYOP_CONNECT);
     char buffer[9]={0};
     char buffer[9]={0};
+    bool responseLogged = false;
     for(;;)
     for(;;)
     {
     {
       int numread = ReceiveNext(buffer, m_pStrBuffer?1:8);
       int numread = ReceiveNext(buffer, m_pStrBuffer?1:8);
@@ -491,9 +492,13 @@ void CAsyncProxySocketLayer::OnReceive(int nErrorCode)
       char *pos = strstr(m_pStrBuffer, "\r\n");
       char *pos = strstr(m_pStrBuffer, "\r\n");
       if (pos)
       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, " ");
         char *pos2 = strstr(m_pStrBuffer, " ");
         if (!pos2 || *(pos2+1)!='2' || pos2>pos)
         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
       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();
         ConnectionEstablished();
         return;
         return;
       }
       }