#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
+#include "istream-crlf.h"
#include "iostream-temp.h"
#include "connection.h"
#include "test-common.h"
static size_t read_client_partial = 0;
static unsigned int test_max_pending = 200;
static unsigned int client_ioloop_nesting = 0;
+static bool test_unknown_size = FALSE;
static struct ip_addr bind_ip;
static in_port_t bind_port = 0;
"failed to open %s", path);
}
+ if (test_unknown_size) {
+ struct istream *ustream;
+
+ ustream = i_stream_create_crlf(fstream);
+ i_stream_unref(&fstream);
+ fstream = ustream;
+ }
+
if (read_server_partial > 0) {
struct istream *partial = i_stream_create_limit
(fstream, read_server_partial);
path, client_files_last);
}
+ if (test_unknown_size) {
+ struct istream *ustream;
+
+ ustream = i_stream_create_crlf(fstream);
+ i_stream_unref(&fstream);
+ fstream = ustream;
+ }
+
tcreq = test_client_request_new();
tcreq->files_idx = client_files_last;
test_begin("http payload download (server non-blocking)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_FORWARD;
test_begin("http payload download (server blocking)");
blocking = TRUE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
test_run_sequential(test_client_download);
test_begin("http payload echo (server non-blocking)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_FORWARD;
test_begin("http payload echo (server non-blocking; low-level)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_LOW_LEVEL;
test_begin("http payload echo (server non-blocking; handler)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_HANDLER;
test_run_pipeline(test_client_echo);
test_run_parallel(test_client_echo);
test_end();
+
+ test_begin("http payload echo (server non-blocking; size unknown)");
+ blocking = FALSE;
+ request_100_continue = FALSE;
+ test_unknown_size = TRUE;
+ read_server_partial = 0;
+ client_ioloop_nesting = 0;
+ server_payload_handling = PAYLOAD_HANDLING_FORWARD;
+ test_run_sequential(test_client_echo);
+ test_run_pipeline(test_client_echo);
+ test_run_parallel(test_client_echo);
+ test_end();
}
static void test_echo_server_blocking(void)
test_begin("http payload echo (server blocking)");
blocking = TRUE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
test_run_sequential(test_client_echo);
test_begin("http payload echo (server non-blocking; 100-continue)");
blocking = FALSE;
request_100_continue = TRUE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_FORWARD;
test_begin("http payload echo (server non-blocking; 100-continue; low-level)");
blocking = FALSE;
request_100_continue = TRUE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_LOW_LEVEL;
test_begin("http payload echo (server non-blocking; 100-continue; handler)");
blocking = FALSE;
request_100_continue = TRUE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_HANDLER;
test_begin("http payload echo (server blocking; 100-continue)");
blocking = TRUE;
request_100_continue = TRUE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
test_run_sequential(test_client_echo);
test_begin("http payload echo (server non-blocking; partial short)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 1024;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_FORWARD;
test_begin("http payload echo (server non-blocking; partial short; low-level)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 1024;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_LOW_LEVEL;
test_begin("http payload echo (server non-blocking; partial short; handler)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 1024;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_HANDLER;
test_begin("http payload echo (server blocking; partial short)");
blocking = TRUE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 1024;
client_ioloop_nesting = 0;
test_run_sequential(test_client_echo);
test_begin("http payload download (client partial)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
read_client_partial = 1024;
client_ioloop_nesting = 0;
test_begin("http payload download (client partial long)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
read_client_partial = IO_BLOCK_SIZE + 1024;
server_payload_handling = PAYLOAD_HANDLING_FORWARD;
test_begin("http payload echo (client nested ioloop)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
read_client_partial = 0;
client_ioloop_nesting = 10;
test_begin("http payload download (server non-blocking; client shared)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_FORWARD;
test_begin("http payload download (server blocking; client shared)");
blocking = TRUE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
parallel_clients = 4;
test_begin("http payload echo (server non-blocking; client shared)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_FORWARD;
test_begin("http payload echo (server blocking; client shared)");
blocking = TRUE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
parallel_clients = 4;
test_begin("http payload echo (server non-blocking; client global)");
blocking = FALSE;
request_100_continue = FALSE;
+ test_unknown_size = FALSE;
read_server_partial = 0;
client_ioloop_nesting = 0;
server_payload_handling = PAYLOAD_HANDLING_FORWARD;