|  | @@ -4380,7 +4380,7 @@ push(struct mg_context *ctx,
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  |  		} else
 |  |  		} else
 | 
											
												
													
														|  |  #endif
 |  |  #endif
 | 
											
												
													
														|  | -	    if (fp != NULL) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +		    if (fp != NULL) {
 | 
											
												
													
														|  |  			n = (int)fwrite(buf, 1, (size_t)len, fp);
 |  |  			n = (int)fwrite(buf, 1, (size_t)len, fp);
 | 
											
												
													
														|  |  			if (ferror(fp)) {
 |  |  			if (ferror(fp)) {
 | 
											
												
													
														|  |  				n = -1;
 |  |  				n = -1;
 | 
											
										
											
												
													
														|  | @@ -12378,6 +12378,12 @@ reset_per_request_attributes(struct mg_connection *conn)
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +#if 0
 | 
											
												
													
														|  | 
 |  | +/* Note: set_sock_timeout is not required for non-blocking sockets.
 | 
											
												
													
														|  | 
 |  | + * Leave this function here (commented out) for reference until 
 | 
											
												
													
														|  | 
 |  | + * CivetWeb 1.9 is tested, and the tests confirme this function is
 | 
											
												
													
														|  | 
 |  | + * no longer required.
 | 
											
												
													
														|  | 
 |  | +*/
 | 
											
												
													
														|  |  static int
 |  |  static int
 | 
											
												
													
														|  |  set_sock_timeout(SOCKET sock, int milliseconds)
 |  |  set_sock_timeout(SOCKET sock, int milliseconds)
 | 
											
												
													
														|  |  {
 |  |  {
 | 
											
										
											
												
													
														|  | @@ -12418,6 +12424,7 @@ set_sock_timeout(SOCKET sock, int milliseconds)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	return r0 || r1 || r2;
 |  |  	return r0 || r1 || r2;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  | 
 |  | +#endif
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  static int
 |  |  static int
 | 
											
										
											
												
													
														|  | @@ -12736,6 +12743,10 @@ mg_connect_client_impl(const struct mg_client_options *client_options,
 | 
											
												
													
														|  |  #endif
 |  |  #endif
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +	if (conn) {
 | 
											
												
													
														|  | 
 |  | +		set_blocking_mode(sock, 0);
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  	return conn;
 |  |  	return conn;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -13121,7 +13132,9 @@ mg_get_response(struct mg_connection *conn,
 | 
											
												
													
														|  |  		if (timeout >= 0) {
 |  |  		if (timeout >= 0) {
 | 
											
												
													
														|  |  			mg_snprintf(conn, NULL, txt, sizeof(txt), "%i", timeout);
 |  |  			mg_snprintf(conn, NULL, txt, sizeof(txt), "%i", timeout);
 | 
											
												
													
														|  |  			rctx.config[REQUEST_TIMEOUT] = txt;
 |  |  			rctx.config[REQUEST_TIMEOUT] = txt;
 | 
											
												
													
														|  | 
 |  | +			/* Not required for non-blocking sockets.
 | 
											
												
													
														|  |  			set_sock_timeout(conn->client.sock, timeout);
 |  |  			set_sock_timeout(conn->client.sock, timeout);
 | 
											
												
													
														|  | 
 |  | +			*/
 | 
											
												
													
														|  |  		} else {
 |  |  		} else {
 | 
											
												
													
														|  |  			rctx.config[REQUEST_TIMEOUT] = NULL;
 |  |  			rctx.config[REQUEST_TIMEOUT] = NULL;
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
										
											
												
													
														|  | @@ -13344,6 +13357,7 @@ mg_connect_websocket_client(const char *host,
 | 
											
												
													
														|  |  		DEBUG_TRACE("%s",
 |  |  		DEBUG_TRACE("%s",
 | 
											
												
													
														|  |  		            "Websocket client connect thread could not be started\r\n");
 |  |  		            "Websocket client connect thread could not be started\r\n");
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  #else
 |  |  #else
 | 
											
												
													
														|  |  	/* Appease "unused parameter" warnings */
 |  |  	/* Appease "unused parameter" warnings */
 | 
											
												
													
														|  |  	(void)host;
 |  |  	(void)host;
 |