Fossil SCM
Simplified version of the previous patch which also catches SSL_read() errors on Windows.
Commit
b70557f690594877e44d211ba0a2a3bab16cf7e3e2d2faafb1dfad21675f1705
Parent
b890451cfbf892e…
1 file changed
+6
-8
+6
-8
| --- src/http_ssl.c | ||
| +++ src/http_ssl.c | ||
| @@ -820,25 +820,23 @@ | ||
| 820 | 820 | SslServerConn *pServer = (SslServerConn*)pServerArg; |
| 821 | 821 | if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); } |
| 822 | 822 | else if( BIO_eof(pServer->bio) ) return 0; |
| 823 | 823 | while( nBuf!=rc ){ |
| 824 | 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 | 825 | if( n==0 ){ |
| 834 | 826 | break; |
| 835 | 827 | }else if(n>0){ |
| 836 | 828 | rc += n; |
| 837 | 829 | }else{ |
| 838 | 830 | fossil_fatal("SSL read error."); |
| 839 | 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; | |
| 840 | 838 | #endif |
| 841 | 839 | } |
| 842 | 840 | return rc; |
| 843 | 841 | } |
| 844 | 842 | |
| 845 | 843 |
| --- 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 |