Merge branch 'master' of https://github.com/bvanassche/fio
[fio.git] / engines / http.c
index cb66ebe663ee7d28cbd06b0e4fc1e06049066bbb..696febe15105784e505847ef2f12d6071c0bbd97 100644 (file)
@@ -273,6 +273,8 @@ static void _hmac(unsigned char *md, void *key, int key_len, char *data) {
        ctx = HMAC_CTX_new();
 #else
        ctx = &_ctx;
+       /* work-around crash in certain versions of libssl */
+       HMAC_CTX_init(ctx);
 #endif
        HMAC_Init_ex(ctx, key, key_len, EVP_sha256(), NULL);
        HMAC_Update(ctx, (unsigned char*)data, strlen(data));
@@ -294,7 +296,8 @@ static int _curl_trace(CURL *handle, curl_infotype type,
 
        switch (type) {
        case CURLINFO_TEXT:
-       fprintf(stderr, "== Info: %s", data);
+               fprintf(stderr, "== Info: %s", data);
+               fio_fallthrough;
        default:
        case CURLINFO_SSL_DATA_OUT:
        case CURLINFO_SSL_DATA_IN:
@@ -385,7 +388,7 @@ static void _add_aws_auth_header(CURL *curl, struct curl_slist *slist, struct ht
 
        signature = _conv_hex(md, SHA256_DIGEST_LENGTH);
 
-       /* Surpress automatic Accept: header */
+       /* Suppress automatic Accept: header */
        slist = curl_slist_append(slist, "Accept:");
 
        snprintf(s, sizeof(s), "x-amz-content-sha256: %s", dsha);
@@ -416,7 +419,7 @@ static void _add_swift_header(CURL *curl, struct curl_slist *slist, struct http_
        if (op == DDIR_WRITE) {
                dsha = _gen_hex_md5(buf, len);
        }
-       /* Surpress automatic Accept: header */
+       /* Suppress automatic Accept: header */
        slist = curl_slist_append(slist, "Accept:");
 
        snprintf(s, sizeof(s), "etag: %s", dsha);
@@ -546,7 +549,7 @@ static enum fio_q_status fio_http_queue(struct thread_data *td,
        } else if (io_u->ddir == DDIR_TRIM) {
                curl_easy_setopt(http->curl, CURLOPT_HTTPGET, 1L);
                curl_easy_setopt(http->curl, CURLOPT_CUSTOMREQUEST, "DELETE");
-               curl_easy_setopt(http->curl, CURLOPT_INFILESIZE_LARGE, 0);
+               curl_easy_setopt(http->curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)0);
                curl_easy_setopt(http->curl, CURLOPT_READDATA, NULL);
                curl_easy_setopt(http->curl, CURLOPT_WRITEDATA, NULL);
                res = curl_easy_perform(http->curl);
@@ -608,7 +611,7 @@ static int fio_http_setup(struct thread_data *td)
        }
        curl_easy_setopt(http->curl, CURLOPT_READFUNCTION, _http_read);
        curl_easy_setopt(http->curl, CURLOPT_WRITEFUNCTION, _http_write);
-       curl_easy_setopt(http->curl, CURLOPT_SEEKFUNCTION, _http_seek);
+       curl_easy_setopt(http->curl, CURLOPT_SEEKFUNCTION, &_http_seek);
        if (o->user && o->pass) {
                curl_easy_setopt(http->curl, CURLOPT_USERNAME, o->user);
                curl_easy_setopt(http->curl, CURLOPT_PASSWORD, o->pass);
@@ -635,10 +638,10 @@ static int fio_http_invalidate(struct thread_data *td, struct fio_file *f)
        return 0;
 }
 
-static struct ioengine_ops ioengine = {
+FIO_STATIC struct ioengine_ops ioengine = {
        .name = "http",
        .version                = FIO_IOOPS_VERSION,
-       .flags                  = FIO_DISKLESSIO,
+       .flags                  = FIO_DISKLESSIO | FIO_SYNCIO,
        .setup                  = fio_http_setup,
        .queue                  = fio_http_queue,
        .getevents              = fio_http_getevents,