toys/simple-http-server-c/source/util.h

22 lines
676 B
C

#pragma once
#include <stdint.h>
#include <stddef.h> /**< size_t */
#include <string.h> /**< strlen */
#if defined (__cplusplus)
extern "C" {
#endif
char *Rfc822DateNow();
#define HttpUrlEncode(src,dst,dstsize) HttpUrlEncodeWithLength(src, strlen(src), dst, dstsize)
int HttpUrlEncodeWithLength(const char *src, size_t srcsize, char *dst, size_t dstsize);
#define HttpUrlDecode(src,dst,dstsize) HttpUrlDecodeWithFormat(src, dst, dstsize, 0);
#define HttpUrlDecodeForm(src,dst,dstsize) HttpUrlDecodeWithFormat(src, dst, dstsize, 1);
int HttpUrlDecodeWithFormat(const char *src, char *dst, size_t dstsize, int is_form_url_encoded);
#if defined (__cplusplus)
}
#endif