the buffer being written to change from one retry to the next. However, in this
case, you must still retry exactly the same data - even though the buffer that
contains that data may change location. See L<SSL_CTX_set_mode(3)> for further
-details.
+details. As in the TLS tutorials (L<ossl-guide-tls-client-block(7)>) we write
+the request in three chunks.
/* Write an HTTP GET request to the peer */
- while (!SSL_write_ex(ssl, request, strlen(request), &written)) {
+ while (!SSL_write_ex(ssl, request_start, strlen(request_start), &written)) {
if (handle_io_failure(ssl, 0) == 1)
continue; /* Retry */
- printf("Failed to write HTTP request\n");
+ printf("Failed to write start of HTTP request\n");
+ goto end; /* Cannot retry: error */
+ }
+ while (!SSL_write_ex(ssl, hostname, strlen(hostname), &written)) {
+ if (handle_io_failure(ssl, 0) == 1)
+ continue; /* Retry */
+ printf("Failed to write hostname in HTTP request\n");
+ goto end; /* Cannot retry: error */
+ }
+ while (!SSL_write_ex(ssl, request_end, strlen(request_end), &written)) {
+ if (handle_io_failure(ssl, 0) == 1)
+ continue; /* Retry */
+ printf("Failed to write end of HTTP request\n");
goto end; /* Cannot retry: error */
}