HTTP PUT a REALLY BIG file to server



I am attempting to push a REALLY big file to a server using a HTTP PUT.  The file already exists in memory and is no larger that 2 Gigabytes (but could be 1.5 - 1.75 Gb).  Here is the code snipet I am using:

    msg = soup_message_new("PUT", file_name);  // create PUT message

    soup_message_headers_set_content_type(msg->request_headers, "application/octet-stream", NULL);

    // copy rec to buffer
    len = ark_record_get_size(rec);
    cnt = ark_record_point(rec, &buffer, len, 0, NULL);
    chunk.buf = soup_buffer_new(SOUP_MEMORY_TAKE, buffer, cnt);
    chunk.offset = 0;

    soup_message_body_append_buffer(msg->request_body, chunk.buf);
    soup_message_body_set_accumulate(msg->request_body, FALSE);

    g_signal_connect(msg, "Wrote_body_data", G_CALLBACK(write_next_chunk), &chunk);
   
    soup_session_send_message (session, msg);

I have found that when I call ark_record_point above that it will return a count that is less than the total size of the file.  If I call ark_record_point again with an offset to the place where the previous call stopped I can get the rest of the file.  It may take 2 or 3 more calls but I can get all of the file.

My question is do I simply set up a look and call soup_message_body_append_buffer again or do I have to call soup_session_send_message first and then call soup_message_body_append?

Thank you

David


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]