You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
lighttpd2/include/lighttpd/chunk_parser.h

52 lines
1.4 KiB

#ifndef _LIGHTTPD_CHUNK_PARSER_H_
#define _LIGHTTPD_CHUNK_PARSER_H_
#ifndef _LIGHTTPD_BASE_H_
#error Please include <lighttpd/base.h> instead of this file
#endif
struct chunk_parser_ctx {
chunkqueue *cq;
goffset bytes_in;
/* current position
* buf is curi[start..start+length)
*/
chunkiter curi;
off_t start, length;
char *buf;
int cs;
};
struct chunk_parser_mark {
chunkiter ci;
off_t pos;
};
LI_API void chunk_parser_init(chunk_parser_ctx *ctx, chunkqueue *cq);
LI_API void chunk_parser_reset(chunk_parser_ctx *ctx);
LI_API handler_t chunk_parser_prepare(chunk_parser_ctx *ctx);
LI_API handler_t chunk_parser_next(struct vrequest *vr, chunk_parser_ctx *ctx, char **p, char **pe);
LI_API void chunk_parser_done(chunk_parser_ctx *ctx, goffset len);
LI_API gboolean chunk_extract_to(struct vrequest *vr, chunk_parser_mark from, chunk_parser_mark to, GString *dest);
LI_API GString* chunk_extract(struct vrequest *vr, chunk_parser_mark from, chunk_parser_mark to);
INLINE chunk_parser_mark chunk_parser_getmark(chunk_parser_ctx *ctx, const char *fpc);
/********************
* Inline functions *
********************/
INLINE chunk_parser_mark chunk_parser_getmark(chunk_parser_ctx *ctx, const char *fpc) {
chunk_parser_mark m;
m.ci = ctx->curi;
m.pos = ctx->start + fpc - ctx->buf;
return m;
}
#define GETMARK(FPC) (chunk_parser_getmark(&ctx->chunk_ctx, FPC))
#endif