Browse Source

HPCC-8760 Revise based on review

Signed-off-by: Kevin Wang <kevin.wang@lexisnexis.com>
Kevin Wang 12 years ago
parent
commit
7f3ac5dd5a

+ 1 - 1
esp/bindings/http/platform/httpbinding.cpp

@@ -1448,7 +1448,7 @@ int EspHttpBinding::onStartUpload(IEspContext &ctx, CHttpRequest* request, CHttp
             throw MakeStringException(-1, "Upload destination not specified.");
 
         StringArray fileNames;
-        request->readContentToFile(netAddress, path, fileNames);
+        request->readContentToFiles(netAddress, path, fileNames);
         return onFinishUpload(ctx, request, response, serv, method);
     }
     catch (IException* e)

+ 3 - 3
esp/bindings/http/platform/httptransport.cpp

@@ -1836,11 +1836,11 @@ int CHttpRequest::processHeaders(IMultiException *me)
 bool CHttpRequest::readContentToBuffer(MemoryBuffer& buffer, __int64& bytesNotRead)
 {
     char buf[1024 + 1];
-    int buflen = 1024;
+    __int64 buflen = 1024;
     if (buflen > bytesNotRead)
         buflen = bytesNotRead;
 
-    int readlen = m_bufferedsocket->read(buf, buflen);
+    int readlen = m_bufferedsocket->read(buf, (int) buflen);
     if(readlen < 0)
         DBGLOG("Failed to read from socket");
 
@@ -1892,7 +1892,7 @@ IFile* CHttpRequest::createUploadFile(StringBuffer netAddress, const char* fileP
     return createIFile(rfn);
 }
 
-int CHttpRequest::readContentToFile(StringBuffer netAddress, StringBuffer path, StringArray& fileNames)
+int CHttpRequest::readContentToFiles(StringBuffer netAddress, StringBuffer path, StringArray& fileNames)
 {
     Owned<CMimeMultiPart> multipart = new CMimeMultiPart("1.0", m_content_type.get(), "", "", "");
     multipart->parseContentType(m_content_type.get());

+ 1 - 1
esp/bindings/http/platform/httptransport.ipp

@@ -358,7 +358,7 @@ public:
     bool readContentToBuffer(MemoryBuffer& fileContent, __int64& bytesNotRead);
     bool readUploadFileName(CMimeMultiPart* mimemultipart, StringBuffer& fileName, MemoryBuffer& contentBuffer, __int64& bytesNotRead);
     IFile* createUploadFile(StringBuffer netAddress, const char* filePath, StringBuffer& fileName);
-    virtual int readContentToFile(StringBuffer netAddress, StringBuffer path, StringArray& fileNames);
+    virtual int readContentToFiles(StringBuffer netAddress, StringBuffer path, StringArray& fileNames);
 };
 
 class CHttpResponse : public CHttpMessage

+ 3 - 3
esp/bindings/http/platform/mime.cpp

@@ -534,9 +534,9 @@ bool CMimeMultiPart::separateMultiParts(MemoryBuffer& firstPart, MemoryBuffer& o
 
     // Get rid of CR/LF at the end of the content
     unsigned firstPartLength = offset;
-    if ((firstPartLength > 1) && (startPos[firstPartLength-2] == '\r') && (startPos[firstPartLength-1] == '\n'))
-        firstPartLength -= 2;
-    else if ((firstPartLength > 0) && ((startPos[firstPartLength-1] == '\r') || (startPos[firstPartLength-1] == '\n')))
+    if ((firstPartLength > 0) && (startPos[firstPartLength-1] == '\n'))
+        firstPartLength--;
+    if ((firstPartLength > 0) && (startPos[firstPartLength-1] == '\r'))
         firstPartLength--;
     if(firstPartLength >= 0)
     {