mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 22:55:47 +01:00
Fix ssl_client2 to send 0-length app data
This commit is contained in:
parent
1a7a17e548
commit
ce6fbac247
@ -247,7 +247,11 @@ int main( void )
|
|||||||
" server_port=%%d default: 4433\n" \
|
" server_port=%%d default: 4433\n" \
|
||||||
" request_page=%%s default: \".\"\n" \
|
" request_page=%%s default: \".\"\n" \
|
||||||
" request_size=%%d default: about 34 (basic request)\n" \
|
" request_size=%%d default: about 34 (basic request)\n" \
|
||||||
" (minimum: 0, max: " MAX_REQUEST_SIZE_STR " )\n" \
|
" (minimum: 0, max: " MAX_REQUEST_SIZE_STR ")\n" \
|
||||||
|
" If 0, in the first exchange only an empty\n" \
|
||||||
|
" application data message is sent followed by\n" \
|
||||||
|
" a second non-empty message before attempting\n" \
|
||||||
|
" to read a response from the server\n" \
|
||||||
" debug_level=%%d default: 0 (disabled)\n" \
|
" debug_level=%%d default: 0 (disabled)\n" \
|
||||||
" nbio=%%d default: 0 (blocking I/O)\n" \
|
" nbio=%%d default: 0 (blocking I/O)\n" \
|
||||||
" options: 1 (non-blocking), 2 (added delays)\n" \
|
" options: 1 (non-blocking), 2 (added delays)\n" \
|
||||||
@ -1663,10 +1667,13 @@ send_request:
|
|||||||
|
|
||||||
if( opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM )
|
if( opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM )
|
||||||
{
|
{
|
||||||
for( written = 0, frags = 0; written < len; written += ret, frags++ )
|
written = 0;
|
||||||
|
frags = 0;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
while( ( ret = mbedtls_ssl_write( &ssl, buf + written,
|
while( ( ret = mbedtls_ssl_write( &ssl, buf + written,
|
||||||
len - written ) ) <= 0 )
|
len - written ) ) < 0 )
|
||||||
{
|
{
|
||||||
if( ret != MBEDTLS_ERR_SSL_WANT_READ &&
|
if( ret != MBEDTLS_ERR_SSL_WANT_READ &&
|
||||||
ret != MBEDTLS_ERR_SSL_WANT_WRITE )
|
ret != MBEDTLS_ERR_SSL_WANT_WRITE )
|
||||||
@ -1686,7 +1693,11 @@ send_request:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frags++;
|
||||||
|
written += ret;
|
||||||
}
|
}
|
||||||
|
while( written < len );
|
||||||
}
|
}
|
||||||
else /* Not stream, so datagram */
|
else /* Not stream, so datagram */
|
||||||
{
|
{
|
||||||
@ -1730,6 +1741,13 @@ send_request:
|
|||||||
mbedtls_printf( " %d bytes written in %d fragments\n\n%s\n",
|
mbedtls_printf( " %d bytes written in %d fragments\n\n%s\n",
|
||||||
written, frags, (char *) buf );
|
written, frags, (char *) buf );
|
||||||
|
|
||||||
|
/* Send a non-empty request if request_size == 0 */
|
||||||
|
if ( len == 0 )
|
||||||
|
{
|
||||||
|
opt.request_size = DFL_REQUEST_SIZE;
|
||||||
|
goto send_request;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 7. Read the HTTP response
|
* 7. Read the HTTP response
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user