Fossil SCM

Simplified version of the previous patch which also catches SSL_read() errors on Windows.

stephan 2022-01-24 08:27 trunk
Commit b70557f690594877e44d211ba0a2a3bab16cf7e3e2d2faafb1dfad21675f1705
1 file changed +6 -8
+6 -8
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -820,25 +820,23 @@
820820
SslServerConn *pServer = (SslServerConn*)pServerArg;
821821
if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); }
822822
else if( BIO_eof(pServer->bio) ) return 0;
823823
while( nBuf!=rc ){
824824
n = SSL_read(pServer->ssl, zBuf + rc, (int)(nBuf - rc));
825
-#ifdef _WIN32
826
- /* Windows (XP and 10 tested with openssl 1.1.1m and 3.0.1) does
827
- ** not require reading in a loop, returning all data in a single
828
- ** call. If we read in a loop on Windows, SSL reads fail. Details:
829
- ** https://fossil-scm.org/forum/forumpost/2f818850abb72719 */
830
- rc += n;
831
- break;
832
-#else
833825
if( n==0 ){
834826
break;
835827
}else if(n>0){
836828
rc += n;
837829
}else{
838830
fossil_fatal("SSL read error.");
839831
}
832
+#ifdef _WIN32
833
+ /* Windows (XP and 10 tested with openssl 1.1.1m and 3.0.1) does
834
+ ** not require reading in a loop, returning all data in a single
835
+ ** call. If we read in a loop on Windows, SSL reads fail. Details:
836
+ ** https://fossil-scm.org/forum/forumpost/2f818850abb72719 */
837
+ break;
840838
#endif
841839
}
842840
return rc;
843841
}
844842
845843
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -820,25 +820,23 @@
820 SslServerConn *pServer = (SslServerConn*)pServerArg;
821 if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); }
822 else if( BIO_eof(pServer->bio) ) return 0;
823 while( nBuf!=rc ){
824 n = SSL_read(pServer->ssl, zBuf + rc, (int)(nBuf - rc));
825 #ifdef _WIN32
826 /* Windows (XP and 10 tested with openssl 1.1.1m and 3.0.1) does
827 ** not require reading in a loop, returning all data in a single
828 ** call. If we read in a loop on Windows, SSL reads fail. Details:
829 ** https://fossil-scm.org/forum/forumpost/2f818850abb72719 */
830 rc += n;
831 break;
832 #else
833 if( n==0 ){
834 break;
835 }else if(n>0){
836 rc += n;
837 }else{
838 fossil_fatal("SSL read error.");
839 }
 
 
 
 
 
 
840 #endif
841 }
842 return rc;
843 }
844
845
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -820,25 +820,23 @@
820 SslServerConn *pServer = (SslServerConn*)pServerArg;
821 if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); }
822 else if( BIO_eof(pServer->bio) ) return 0;
823 while( nBuf!=rc ){
824 n = SSL_read(pServer->ssl, zBuf + rc, (int)(nBuf - rc));
 
 
 
 
 
 
 
 
825 if( n==0 ){
826 break;
827 }else if(n>0){
828 rc += n;
829 }else{
830 fossil_fatal("SSL read error.");
831 }
832 #ifdef _WIN32
833 /* Windows (XP and 10 tested with openssl 1.1.1m and 3.0.1) does
834 ** not require reading in a loop, returning all data in a single
835 ** call. If we read in a loop on Windows, SSL reads fail. Details:
836 ** https://fossil-scm.org/forum/forumpost/2f818850abb72719 */
837 break;
838 #endif
839 }
840 return rc;
841 }
842
843

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button