Fossil SCM
merge latest trunk
Commit
8dde27776839648293b3803dced9783180ea3fbd8757d5be1334d6e27a35c0de
Parent
ad66227c8de434e…
5 files changed
+19
-5
+19
-5
+2
+2
+1
+19
-5
| --- src/http_ssl.c | ||
| +++ src/http_ssl.c | ||
| @@ -752,10 +752,11 @@ | ||
| 752 | 752 | |
| 753 | 753 | typedef struct SslServerConn { |
| 754 | 754 | SSL *ssl; /* The SSL codec */ |
| 755 | 755 | int atEof; /* True when EOF reached. */ |
| 756 | 756 | int iSocket; /* The socket */ |
| 757 | + BIO *bio; /* BIO object. Needed for EOF detection. */ | |
| 757 | 758 | } SslServerConn; |
| 758 | 759 | |
| 759 | 760 | /* |
| 760 | 761 | ** Create a new server-side codec. The argument is the socket's file |
| 761 | 762 | ** descriptor from which the codec reads and writes. The returned |
| @@ -765,10 +766,11 @@ | ||
| 765 | 766 | SslServerConn *pServer = fossil_malloc_zero(sizeof(*pServer)); |
| 766 | 767 | BIO *b = BIO_new_socket(iSocket, 0); |
| 767 | 768 | pServer->ssl = SSL_new(sslCtx); |
| 768 | 769 | pServer->atEof = 0; |
| 769 | 770 | pServer->iSocket = iSocket; |
| 771 | + pServer->bio = b; | |
| 770 | 772 | SSL_set_bio(pServer->ssl, b, b); |
| 771 | 773 | SSL_accept(pServer->ssl); |
| 772 | 774 | return (void*)pServer; |
| 773 | 775 | } |
| 774 | 776 | |
| @@ -793,17 +795,29 @@ | ||
| 793 | 795 | /* |
| 794 | 796 | ** Read cleartext bytes that have been received from the client and |
| 795 | 797 | ** decrypted by the SSL server codec. |
| 796 | 798 | */ |
| 797 | 799 | size_t ssl_read_server(void *pServerArg, char *zBuf, size_t nBuf){ |
| 798 | - int n; | |
| 800 | + int n, err = 0; | |
| 801 | + size_t rc = 0; | |
| 799 | 802 | SslServerConn *pServer = (SslServerConn*)pServerArg; |
| 800 | - if( pServer->atEof ) return 0; | |
| 801 | 803 | if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); } |
| 802 | - n = SSL_read(pServer->ssl, zBuf, (int)nBuf); | |
| 803 | - if( n==0 ) pServer->atEof = 1; | |
| 804 | - return n<=0 ? 0 : n; | |
| 804 | + while( 0==err && nBuf!=rc && 0==pServer->atEof ){ | |
| 805 | + n = SSL_read(pServer->ssl, zBuf + rc, (int)(nBuf - rc)); | |
| 806 | + if( n==0 ){ | |
| 807 | + pServer->atEof = 1; | |
| 808 | + break; | |
| 809 | + } | |
| 810 | + err = SSL_get_error(pServer->ssl, n); | |
| 811 | + if(0==err){ | |
| 812 | + rc += n; | |
| 813 | + pServer->atEof = BIO_eof(pServer->bio); | |
| 814 | + }else{ | |
| 815 | + fossil_fatal("SSL read error."); | |
| 816 | + } | |
| 817 | + } | |
| 818 | + return rc; | |
| 805 | 819 | } |
| 806 | 820 | |
| 807 | 821 | /* |
| 808 | 822 | ** Read a single line of text from the client. |
| 809 | 823 | */ |
| 810 | 824 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -752,10 +752,11 @@ | |
| 752 | |
| 753 | typedef struct SslServerConn { |
| 754 | SSL *ssl; /* The SSL codec */ |
| 755 | int atEof; /* True when EOF reached. */ |
| 756 | int iSocket; /* The socket */ |
| 757 | } SslServerConn; |
| 758 | |
| 759 | /* |
| 760 | ** Create a new server-side codec. The argument is the socket's file |
| 761 | ** descriptor from which the codec reads and writes. The returned |
| @@ -765,10 +766,11 @@ | |
| 765 | SslServerConn *pServer = fossil_malloc_zero(sizeof(*pServer)); |
| 766 | BIO *b = BIO_new_socket(iSocket, 0); |
| 767 | pServer->ssl = SSL_new(sslCtx); |
| 768 | pServer->atEof = 0; |
| 769 | pServer->iSocket = iSocket; |
| 770 | SSL_set_bio(pServer->ssl, b, b); |
| 771 | SSL_accept(pServer->ssl); |
| 772 | return (void*)pServer; |
| 773 | } |
| 774 | |
| @@ -793,17 +795,29 @@ | |
| 793 | /* |
| 794 | ** Read cleartext bytes that have been received from the client and |
| 795 | ** decrypted by the SSL server codec. |
| 796 | */ |
| 797 | size_t ssl_read_server(void *pServerArg, char *zBuf, size_t nBuf){ |
| 798 | int n; |
| 799 | SslServerConn *pServer = (SslServerConn*)pServerArg; |
| 800 | if( pServer->atEof ) return 0; |
| 801 | if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); } |
| 802 | n = SSL_read(pServer->ssl, zBuf, (int)nBuf); |
| 803 | if( n==0 ) pServer->atEof = 1; |
| 804 | return n<=0 ? 0 : n; |
| 805 | } |
| 806 | |
| 807 | /* |
| 808 | ** Read a single line of text from the client. |
| 809 | */ |
| 810 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -752,10 +752,11 @@ | |
| 752 | |
| 753 | typedef struct SslServerConn { |
| 754 | SSL *ssl; /* The SSL codec */ |
| 755 | int atEof; /* True when EOF reached. */ |
| 756 | int iSocket; /* The socket */ |
| 757 | BIO *bio; /* BIO object. Needed for EOF detection. */ |
| 758 | } SslServerConn; |
| 759 | |
| 760 | /* |
| 761 | ** Create a new server-side codec. The argument is the socket's file |
| 762 | ** descriptor from which the codec reads and writes. The returned |
| @@ -765,10 +766,11 @@ | |
| 766 | SslServerConn *pServer = fossil_malloc_zero(sizeof(*pServer)); |
| 767 | BIO *b = BIO_new_socket(iSocket, 0); |
| 768 | pServer->ssl = SSL_new(sslCtx); |
| 769 | pServer->atEof = 0; |
| 770 | pServer->iSocket = iSocket; |
| 771 | pServer->bio = b; |
| 772 | SSL_set_bio(pServer->ssl, b, b); |
| 773 | SSL_accept(pServer->ssl); |
| 774 | return (void*)pServer; |
| 775 | } |
| 776 | |
| @@ -793,17 +795,29 @@ | |
| 795 | /* |
| 796 | ** Read cleartext bytes that have been received from the client and |
| 797 | ** decrypted by the SSL server codec. |
| 798 | */ |
| 799 | size_t ssl_read_server(void *pServerArg, char *zBuf, size_t nBuf){ |
| 800 | int n, err = 0; |
| 801 | size_t rc = 0; |
| 802 | SslServerConn *pServer = (SslServerConn*)pServerArg; |
| 803 | if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); } |
| 804 | while( 0==err && nBuf!=rc && 0==pServer->atEof ){ |
| 805 | n = SSL_read(pServer->ssl, zBuf + rc, (int)(nBuf - rc)); |
| 806 | if( n==0 ){ |
| 807 | pServer->atEof = 1; |
| 808 | break; |
| 809 | } |
| 810 | err = SSL_get_error(pServer->ssl, n); |
| 811 | if(0==err){ |
| 812 | rc += n; |
| 813 | pServer->atEof = BIO_eof(pServer->bio); |
| 814 | }else{ |
| 815 | fossil_fatal("SSL read error."); |
| 816 | } |
| 817 | } |
| 818 | return rc; |
| 819 | } |
| 820 | |
| 821 | /* |
| 822 | ** Read a single line of text from the client. |
| 823 | */ |
| 824 |
+19
-5
| --- src/http_ssl.c | ||
| +++ src/http_ssl.c | ||
| @@ -752,10 +752,11 @@ | ||
| 752 | 752 | |
| 753 | 753 | typedef struct SslServerConn { |
| 754 | 754 | SSL *ssl; /* The SSL codec */ |
| 755 | 755 | int atEof; /* True when EOF reached. */ |
| 756 | 756 | int iSocket; /* The socket */ |
| 757 | + BIO *bio; /* BIO object. Needed for EOF detection. */ | |
| 757 | 758 | } SslServerConn; |
| 758 | 759 | |
| 759 | 760 | /* |
| 760 | 761 | ** Create a new server-side codec. The argument is the socket's file |
| 761 | 762 | ** descriptor from which the codec reads and writes. The returned |
| @@ -765,10 +766,11 @@ | ||
| 765 | 766 | SslServerConn *pServer = fossil_malloc_zero(sizeof(*pServer)); |
| 766 | 767 | BIO *b = BIO_new_socket(iSocket, 0); |
| 767 | 768 | pServer->ssl = SSL_new(sslCtx); |
| 768 | 769 | pServer->atEof = 0; |
| 769 | 770 | pServer->iSocket = iSocket; |
| 771 | + pServer->bio = b; | |
| 770 | 772 | SSL_set_bio(pServer->ssl, b, b); |
| 771 | 773 | SSL_accept(pServer->ssl); |
| 772 | 774 | return (void*)pServer; |
| 773 | 775 | } |
| 774 | 776 | |
| @@ -793,17 +795,29 @@ | ||
| 793 | 795 | /* |
| 794 | 796 | ** Read cleartext bytes that have been received from the client and |
| 795 | 797 | ** decrypted by the SSL server codec. |
| 796 | 798 | */ |
| 797 | 799 | size_t ssl_read_server(void *pServerArg, char *zBuf, size_t nBuf){ |
| 798 | - int n; | |
| 800 | + int n, err = 0; | |
| 801 | + size_t rc = 0; | |
| 799 | 802 | SslServerConn *pServer = (SslServerConn*)pServerArg; |
| 800 | - if( pServer->atEof ) return 0; | |
| 801 | 803 | if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); } |
| 802 | - n = SSL_read(pServer->ssl, zBuf, (int)nBuf); | |
| 803 | - if( n==0 ) pServer->atEof = 1; | |
| 804 | - return n<=0 ? 0 : n; | |
| 804 | + while( 0==err && nBuf!=rc && 0==pServer->atEof ){ | |
| 805 | + n = SSL_read(pServer->ssl, zBuf + rc, (int)(nBuf - rc)); | |
| 806 | + if( n==0 ){ | |
| 807 | + pServer->atEof = 1; | |
| 808 | + break; | |
| 809 | + } | |
| 810 | + err = SSL_get_error(pServer->ssl, n); | |
| 811 | + if(0==err){ | |
| 812 | + rc += n; | |
| 813 | + pServer->atEof = BIO_eof(pServer->bio); | |
| 814 | + }else{ | |
| 815 | + fossil_fatal("SSL read error."); | |
| 816 | + } | |
| 817 | + } | |
| 818 | + return rc; | |
| 805 | 819 | } |
| 806 | 820 | |
| 807 | 821 | /* |
| 808 | 822 | ** Read a single line of text from the client. |
| 809 | 823 | */ |
| 810 | 824 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -752,10 +752,11 @@ | |
| 752 | |
| 753 | typedef struct SslServerConn { |
| 754 | SSL *ssl; /* The SSL codec */ |
| 755 | int atEof; /* True when EOF reached. */ |
| 756 | int iSocket; /* The socket */ |
| 757 | } SslServerConn; |
| 758 | |
| 759 | /* |
| 760 | ** Create a new server-side codec. The argument is the socket's file |
| 761 | ** descriptor from which the codec reads and writes. The returned |
| @@ -765,10 +766,11 @@ | |
| 765 | SslServerConn *pServer = fossil_malloc_zero(sizeof(*pServer)); |
| 766 | BIO *b = BIO_new_socket(iSocket, 0); |
| 767 | pServer->ssl = SSL_new(sslCtx); |
| 768 | pServer->atEof = 0; |
| 769 | pServer->iSocket = iSocket; |
| 770 | SSL_set_bio(pServer->ssl, b, b); |
| 771 | SSL_accept(pServer->ssl); |
| 772 | return (void*)pServer; |
| 773 | } |
| 774 | |
| @@ -793,17 +795,29 @@ | |
| 793 | /* |
| 794 | ** Read cleartext bytes that have been received from the client and |
| 795 | ** decrypted by the SSL server codec. |
| 796 | */ |
| 797 | size_t ssl_read_server(void *pServerArg, char *zBuf, size_t nBuf){ |
| 798 | int n; |
| 799 | SslServerConn *pServer = (SslServerConn*)pServerArg; |
| 800 | if( pServer->atEof ) return 0; |
| 801 | if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); } |
| 802 | n = SSL_read(pServer->ssl, zBuf, (int)nBuf); |
| 803 | if( n==0 ) pServer->atEof = 1; |
| 804 | return n<=0 ? 0 : n; |
| 805 | } |
| 806 | |
| 807 | /* |
| 808 | ** Read a single line of text from the client. |
| 809 | */ |
| 810 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -752,10 +752,11 @@ | |
| 752 | |
| 753 | typedef struct SslServerConn { |
| 754 | SSL *ssl; /* The SSL codec */ |
| 755 | int atEof; /* True when EOF reached. */ |
| 756 | int iSocket; /* The socket */ |
| 757 | BIO *bio; /* BIO object. Needed for EOF detection. */ |
| 758 | } SslServerConn; |
| 759 | |
| 760 | /* |
| 761 | ** Create a new server-side codec. The argument is the socket's file |
| 762 | ** descriptor from which the codec reads and writes. The returned |
| @@ -765,10 +766,11 @@ | |
| 766 | SslServerConn *pServer = fossil_malloc_zero(sizeof(*pServer)); |
| 767 | BIO *b = BIO_new_socket(iSocket, 0); |
| 768 | pServer->ssl = SSL_new(sslCtx); |
| 769 | pServer->atEof = 0; |
| 770 | pServer->iSocket = iSocket; |
| 771 | pServer->bio = b; |
| 772 | SSL_set_bio(pServer->ssl, b, b); |
| 773 | SSL_accept(pServer->ssl); |
| 774 | return (void*)pServer; |
| 775 | } |
| 776 | |
| @@ -793,17 +795,29 @@ | |
| 795 | /* |
| 796 | ** Read cleartext bytes that have been received from the client and |
| 797 | ** decrypted by the SSL server codec. |
| 798 | */ |
| 799 | size_t ssl_read_server(void *pServerArg, char *zBuf, size_t nBuf){ |
| 800 | int n, err = 0; |
| 801 | size_t rc = 0; |
| 802 | SslServerConn *pServer = (SslServerConn*)pServerArg; |
| 803 | if( nBuf>0x7fffffff ){ fossil_fatal("SSL read too big"); } |
| 804 | while( 0==err && nBuf!=rc && 0==pServer->atEof ){ |
| 805 | n = SSL_read(pServer->ssl, zBuf + rc, (int)(nBuf - rc)); |
| 806 | if( n==0 ){ |
| 807 | pServer->atEof = 1; |
| 808 | break; |
| 809 | } |
| 810 | err = SSL_get_error(pServer->ssl, n); |
| 811 | if(0==err){ |
| 812 | rc += n; |
| 813 | pServer->atEof = BIO_eof(pServer->bio); |
| 814 | }else{ |
| 815 | fossil_fatal("SSL read error."); |
| 816 | } |
| 817 | } |
| 818 | return rc; |
| 819 | } |
| 820 | |
| 821 | /* |
| 822 | ** Read a single line of text from the client. |
| 823 | */ |
| 824 |
+2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -3293,10 +3293,12 @@ | ||
| 3293 | 3293 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 3294 | 3294 | db_close(1); |
| 3295 | 3295 | |
| 3296 | 3296 | /* Start up an HTTP server |
| 3297 | 3297 | */ |
| 3298 | + fossil_setenv("SERVER_SOFTWARE", "fossil version " RELEASE_VERSION | |
| 3299 | + " " MANIFEST_VERSION " " MANIFEST_DATE); | |
| 3298 | 3300 | #if !defined(_WIN32) |
| 3299 | 3301 | /* Unix implementation */ |
| 3300 | 3302 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 3301 | 3303 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 3302 | 3304 | } |
| 3303 | 3305 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -3293,10 +3293,12 @@ | |
| 3293 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 3294 | db_close(1); |
| 3295 | |
| 3296 | /* Start up an HTTP server |
| 3297 | */ |
| 3298 | #if !defined(_WIN32) |
| 3299 | /* Unix implementation */ |
| 3300 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 3301 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 3302 | } |
| 3303 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -3293,10 +3293,12 @@ | |
| 3293 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 3294 | db_close(1); |
| 3295 | |
| 3296 | /* Start up an HTTP server |
| 3297 | */ |
| 3298 | fossil_setenv("SERVER_SOFTWARE", "fossil version " RELEASE_VERSION |
| 3299 | " " MANIFEST_VERSION " " MANIFEST_DATE); |
| 3300 | #if !defined(_WIN32) |
| 3301 | /* Unix implementation */ |
| 3302 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 3303 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 3304 | } |
| 3305 |
+2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -3293,10 +3293,12 @@ | ||
| 3293 | 3293 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 3294 | 3294 | db_close(1); |
| 3295 | 3295 | |
| 3296 | 3296 | /* Start up an HTTP server |
| 3297 | 3297 | */ |
| 3298 | + fossil_setenv("SERVER_SOFTWARE", "fossil version " RELEASE_VERSION | |
| 3299 | + " " MANIFEST_VERSION " " MANIFEST_DATE); | |
| 3298 | 3300 | #if !defined(_WIN32) |
| 3299 | 3301 | /* Unix implementation */ |
| 3300 | 3302 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 3301 | 3303 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 3302 | 3304 | } |
| 3303 | 3305 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -3293,10 +3293,12 @@ | |
| 3293 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 3294 | db_close(1); |
| 3295 | |
| 3296 | /* Start up an HTTP server |
| 3297 | */ |
| 3298 | #if !defined(_WIN32) |
| 3299 | /* Unix implementation */ |
| 3300 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 3301 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 3302 | } |
| 3303 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -3293,10 +3293,12 @@ | |
| 3293 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 3294 | db_close(1); |
| 3295 | |
| 3296 | /* Start up an HTTP server |
| 3297 | */ |
| 3298 | fossil_setenv("SERVER_SOFTWARE", "fossil version " RELEASE_VERSION |
| 3299 | " " MANIFEST_VERSION " " MANIFEST_DATE); |
| 3300 | #if !defined(_WIN32) |
| 3301 | /* Unix implementation */ |
| 3302 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 3303 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 3304 | } |
| 3305 |
+1
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -1394,10 +1394,11 @@ | ||
| 1394 | 1394 | #endif |
| 1395 | 1395 | @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br /> |
| 1396 | 1396 | @ fossil_exe_id() = %h(fossil_exe_id())<br /> |
| 1397 | 1397 | @ <hr /> |
| 1398 | 1398 | P("HTTP_USER_AGENT"); |
| 1399 | + P("SERVER_SOFTWARE"); | |
| 1399 | 1400 | cgi_print_all(showAll, 0); |
| 1400 | 1401 | if( showAll && blob_size(&g.httpHeader)>0 ){ |
| 1401 | 1402 | @ <hr /> |
| 1402 | 1403 | @ <pre> |
| 1403 | 1404 | @ %h(blob_str(&g.httpHeader)) |
| 1404 | 1405 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1394,10 +1394,11 @@ | |
| 1394 | #endif |
| 1395 | @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br /> |
| 1396 | @ fossil_exe_id() = %h(fossil_exe_id())<br /> |
| 1397 | @ <hr /> |
| 1398 | P("HTTP_USER_AGENT"); |
| 1399 | cgi_print_all(showAll, 0); |
| 1400 | if( showAll && blob_size(&g.httpHeader)>0 ){ |
| 1401 | @ <hr /> |
| 1402 | @ <pre> |
| 1403 | @ %h(blob_str(&g.httpHeader)) |
| 1404 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1394,10 +1394,11 @@ | |
| 1394 | #endif |
| 1395 | @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br /> |
| 1396 | @ fossil_exe_id() = %h(fossil_exe_id())<br /> |
| 1397 | @ <hr /> |
| 1398 | P("HTTP_USER_AGENT"); |
| 1399 | P("SERVER_SOFTWARE"); |
| 1400 | cgi_print_all(showAll, 0); |
| 1401 | if( showAll && blob_size(&g.httpHeader)>0 ){ |
| 1402 | @ <hr /> |
| 1403 | @ <pre> |
| 1404 | @ %h(blob_str(&g.httpHeader)) |
| 1405 |