cosmopolitan/net/http/escape.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.9 KiB
C
Raw Permalink Normal View History

#ifndef COSMOPOLITAN_NET_HTTP_ESCAPE_H_
#define COSMOPOLITAN_NET_HTTP_ESCAPE_H_
Add /statusz page to redbean plus other enhancements redbean improvements: - Explicitly disable corking - Simulate Python regex API for Lua - Send warmup requests in main process on startup - Add Class-A granular IPv4 network classification - Add /statusz page so you can monitor your redbean's health - Fix regressions on OpenBSD/NetBSD caused by recent changes - Plug Authorization header into Lua GetUser and GetPass APIs - Recognize X-Forwarded-{For,Host} from local reverse proxies - Add many additional functions to redbean Lua server page API - Report resource usage of child processes on `/` listing page - Introduce `-a` flag for logging child process resource usage - Introduce `-t MILLIS` flag and `ProgramTimeout(ms)` init API - Introduce `-H "Header: value"` flag and `ProgramHeader(k,v)` API Cosmopolitan Libc improvements: - Make strerror() simpler - Make inet_pton() not depend on sscanf() - Fix OpenExecutable() which broke .data section earlier - Fix stdio in cases where it overflows kernel tty buffer - Fix bugs in crash reporting w/o .com.dbg binary present - Add polyfills for SO_LINGER, SO_RCVTIMEO, and SO_SNDTIMEO - Polyfill TCP_CORK on BSD and XNU using TCP_NOPUSH magnums New netcat clone in examples/nc.c: While testing some of the failure conditions for redbean, I noticed that BusyBox's `nc` command is pretty busted, if you use it as an interactive tool, rather than having it be part of a pipeline. Unfortunately this'll only work on UNIX since Windows doesn't let us poll on stdio and sockets at the same time because I don't think they want tools like this running on their platform. So if you want forbidden fruit, it's here so enjoy it
2021-04-23 17:45:19 +00:00
#define kControlWs 1
#define kControlC0 2
#define kControlC1 4
COSMOPOLITAN_C_START_
extern const char kEscapeAuthority[256];
extern const char kEscapeIp[256];
extern const char kEscapePath[256];
extern const char kEscapeSegment[256];
extern const char kEscapeParam[256];
extern const char kEscapeFragment[256];
2024-06-01 10:19:53 +00:00
char *EscapeHtml(const char *, size_t, size_t *) libcesque;
char *EscapeUrl(const char *, size_t, size_t *, const char[256]) libcesque;
char *EscapeUser(const char *, size_t, size_t *) libcesque;
char *EscapePass(const char *, size_t, size_t *) libcesque;
char *EscapeIp(const char *, size_t, size_t *) libcesque;
char *EscapeHost(const char *, size_t, size_t *) libcesque;
char *EscapePath(const char *, size_t, size_t *) libcesque;
char *EscapeParam(const char *, size_t, size_t *) libcesque;
char *EscapeFragment(const char *, size_t, size_t *) libcesque;
char *EscapeSegment(const char *, size_t, size_t *) libcesque;
char *EscapeJsStringLiteral(char **, size_t *, const char *, size_t,
size_t *) libcesque;
Add /statusz page to redbean plus other enhancements redbean improvements: - Explicitly disable corking - Simulate Python regex API for Lua - Send warmup requests in main process on startup - Add Class-A granular IPv4 network classification - Add /statusz page so you can monitor your redbean's health - Fix regressions on OpenBSD/NetBSD caused by recent changes - Plug Authorization header into Lua GetUser and GetPass APIs - Recognize X-Forwarded-{For,Host} from local reverse proxies - Add many additional functions to redbean Lua server page API - Report resource usage of child processes on `/` listing page - Introduce `-a` flag for logging child process resource usage - Introduce `-t MILLIS` flag and `ProgramTimeout(ms)` init API - Introduce `-H "Header: value"` flag and `ProgramHeader(k,v)` API Cosmopolitan Libc improvements: - Make strerror() simpler - Make inet_pton() not depend on sscanf() - Fix OpenExecutable() which broke .data section earlier - Fix stdio in cases where it overflows kernel tty buffer - Fix bugs in crash reporting w/o .com.dbg binary present - Add polyfills for SO_LINGER, SO_RCVTIMEO, and SO_SNDTIMEO - Polyfill TCP_CORK on BSD and XNU using TCP_NOPUSH magnums New netcat clone in examples/nc.c: While testing some of the failure conditions for redbean, I noticed that BusyBox's `nc` command is pretty busted, if you use it as an interactive tool, rather than having it be part of a pipeline. Unfortunately this'll only work on UNIX since Windows doesn't let us poll on stdio and sockets at the same time because I don't think they want tools like this running on their platform. So if you want forbidden fruit, it's here so enjoy it
2021-04-23 17:45:19 +00:00
2024-06-01 10:19:53 +00:00
ssize_t HasControlCodes(const char *, size_t, int) libcesque;
char *Underlong(const char *, size_t, size_t *) libcesque;
char *DecodeLatin1(const char *, size_t, size_t *) libcesque;
char *EncodeLatin1(const char *, size_t, size_t *, int) libcesque;
char *EncodeHttpHeaderValue(const char *, size_t, size_t *) libcesque;
char *VisualizeControlCodes(const char *, size_t, size_t *) libcesque;
char *IndentLines(const char *, size_t, size_t *, size_t) libcesque;
char *EncodeBase32(const char *, size_t, const char *, size_t,
size_t *) libcesque;
char *DecodeBase32(const char *, size_t, const char *, size_t,
size_t *) libcesque;
char *EncodeBase64(const char *, size_t, size_t *) libcesque;
char *DecodeBase64(const char *, size_t, size_t *) libcesque;
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_NET_HTTP_ESCAPE_H_ */