diff --git a/c302.c b/c302.c index 313668e..645d619 100644 --- a/c302.c +++ b/c302.c @@ -21,15 +21,13 @@ int main(int argc, char **argv) { http_error(HTTP500, "Argument Count Error."); return 1; } - srand(time(NULL)); - uint32_t i = rand() % (sizeof(urls)/sizeof(char*)); + uint32_t i = time(NULL) % (sizeof(urls)/sizeof(char*)); uint32_t len = sizeof(HTTP302HEAD)-1 + urlsl[i] + 4 + sizeof(CONTENT)-1; - const struct iovec iov[5] = { + const struct iovec iov[4] = { {(void *)&len, sizeof(uint32_t)}, {HTTP302HEAD, sizeof(HTTP302HEAD)-1}, {(void *)urls[i], urlsl[i]}, - {"\r\n\r\n", 4}, - {CONTENT, sizeof(CONTENT)-1} + {"\r\n\r\n" CONTENT, 4+sizeof(CONTENT)-1} }; - return writev(1, (const struct iovec *)&iov, 5) != len+sizeof(uint32_t); + return writev(1, (const struct iovec *)&iov, 4) != len+sizeof(uint32_t); }