47 lines
1.7 KiB
C
47 lines
1.7 KiB
C
#ifndef VESSEL_WEB_HTTPBODY_H_
|
|
#define VESSEL_WEB_HTTPBODY_H_
|
|
|
|
#include "conf.h"
|
|
|
|
#include <vessel/def.h>
|
|
#include <vessel/stream.h>
|
|
|
|
typedef struct {
|
|
vs_Stream *stream;
|
|
bool chunked;
|
|
bool finished;
|
|
size_t datasz;
|
|
} vw_HTTPBody;
|
|
|
|
bool vw_HTTPBody_init(vw_HTTPBody *body, vs_Stream *stream, size_t datasz, bool chunked);
|
|
|
|
bool vw_HTTPBody_read1(vw_HTTPBody *body, void *buf);
|
|
size_t vw_HTTPBody_read(vw_HTTPBody *body, void *buf, size_t count);
|
|
size_t vw_HTTPBody_readb(vw_HTTPBody *body,
|
|
void *buf,
|
|
size_t buf_size,
|
|
const void *boundary,
|
|
size_t boundary_size,
|
|
bool *found,
|
|
bool is_string);
|
|
size_t vw_HTTPBody_readbf(vw_HTTPBody *body,
|
|
void *buf,
|
|
size_t buf_size,
|
|
bool *found,
|
|
bool is_string,
|
|
const char *boundary_fmt,
|
|
...) __attribute__((format(printf, 6, 7)));
|
|
|
|
size_t vw_HTTPBody_write(vw_HTTPBody *body, const void *buf, size_t count);
|
|
size_t vw_HTTPBody_write_chunk(vw_HTTPBody *body, const void *buf, size_t count);
|
|
size_t vw_HTTPBody_writef(vw_HTTPBody *body, const char *fmt, ...)
|
|
__attribute__((format(printf, 2, 3)));
|
|
size_t vw_HTTPBody_writef_chunk(vw_HTTPBody *body, const char *fmt, ...)
|
|
__attribute__((format(printf, 2, 3)));
|
|
|
|
size_t vw_HTTPBody_skip_content(vw_HTTPBody *body);
|
|
bool vw_HTTPBody_adjust_chunkiness(vw_HTTPBody *body, bool chunked, size_t datasz);
|
|
|
|
bool vw_HTTPBody_destroy(vw_HTTPBody *body);
|
|
|
|
#endif /* VESSEL_WEB_HTTPBODY_H_ */
|