Revision 64144d8f chunk_pusher_curl.c
chunk_pusher_curl.c | ||
---|---|---|
1 | 1 |
#include <curl/curl.h> |
2 | 2 |
|
3 |
#include "external_chunk_transcoding.h" |
|
3 |
#include <chunk.h> |
|
4 |
|
|
4 | 5 |
#include "chunker_streamer.h" |
5 | 6 |
|
6 | 7 |
|
7 | 8 |
void initChunkPusher(); |
8 | 9 |
void finalizeChunkPusher(); |
9 |
int sendViaCurl(Chunk gchunk, size_t attr_size, ExternalChunk *echunk, char *url);
|
|
10 |
int sendViaCurl(Chunk gchunk, int buffer_size, char *url);
|
|
10 | 11 |
|
11 | 12 |
|
12 | 13 |
void initChunkPusher() { |
... | ... | |
18 | 19 |
curl_global_cleanup(); |
19 | 20 |
} |
20 | 21 |
|
21 |
|
|
22 |
int sendViaCurl(Chunk gchunk, size_t attr_size, ExternalChunk *echunk, char *url) { |
|
22 |
int sendViaCurl(Chunk gchunk, int buffer_size, char *url) { |
|
23 | 23 |
//MAKE THE CURL EASY HANDLE GLOBAL? TO REUSE IT? |
24 | 24 |
CURL *curl_handle; |
25 | 25 |
struct curl_slist *headers=NULL; |
26 | 26 |
uint8_t *buffer=NULL; |
27 |
size_t buffer_size = 0; |
|
27 |
|
|
28 | 28 |
int ret = STREAMER_FAIL_RETURN; |
29 | 29 |
|
30 |
/* 20 bytes are needed to put the chunk header info on the wire */ |
|
31 |
buffer_size = GRAPES_ENCODED_CHUNK_HEADER_SIZE + attr_size + echunk->payload_len; |
|
32 | 30 |
if( (buffer = malloc(buffer_size)) != NULL) { |
33 | 31 |
/* encode the GRAPES chunk into network bytes */ |
34 | 32 |
encodeChunk(&gchunk, buffer, buffer_size); |
Also available in: Unified diff