Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Get rid of empty CHTTPSock::WriteFileGzipped method if there's no zli…

…b. It's still in the header, but this does not have any negative side effects.
  • Loading branch information...
commit b0101a6df1091dff5366ea84a9efdabd66e90026 1 parent ea94795
@KiNgMaR KiNgMaR authored
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/HTTPSock.cpp
View
20 src/HTTPSock.cpp
@@ -307,18 +307,18 @@ bool CHTTPSock::PrintFile(const CString& sFileName, CString sContentType) {
}
#ifdef HAVE_ZLIB
- bool bGzip = (sContentType.Left(5).Equals("text/") || sFileName.Right(3).Equals(".js"));
-#else
- bool bGzip = false; // hello optimizer
-#endif
- if (!bGzip || !m_bAcceptGzip) {
- PrintHeader(iSize, sContentType);
- WriteFileUncompressed(File);
- } else {
+ bool bGzip = m_bAcceptGzip && (sContentType.Left(5).Equals("text/") || sFileName.Right(3).Equals(".js"));
+
+ if (bGzip) {
DEBUG("- Sending gzip-compressed.");
AddHeader("Content-Encoding", "gzip");
PrintHeader(0, sContentType); // we do not know the compressed data's length
WriteFileGzipped(File);
+ } else
+#endif
+ {
+ PrintHeader(iSize, sContentType);
+ WriteFileUncompressed(File);
}
}
@@ -346,8 +346,8 @@ void CHTTPSock::WriteFileUncompressed(CFile& File) {
}
}
-void CHTTPSock::WriteFileGzipped(CFile& File) {
#ifdef HAVE_ZLIB
+void CHTTPSock::WriteFileGzipped(CFile& File) {
char szBufIn[8192];
char szBufOut[8192];
off_t iFileSize = File.GetSize(), iFileReadTotal = 0;
@@ -398,8 +398,8 @@ void CHTTPSock::WriteFileGzipped(CFile& File) {
} while (zStatus == Z_OK);
deflateEnd(&zStrm);
-#endif
}
+#endif
void CHTTPSock::ParseURI() {
ParseParams(m_sURI.Token(1, true, "?"), m_msvsGETParams);
Please sign in to comment.
Something went wrong with that request. Please try again.