mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 08:18:30 +00:00
Make more major improvements to redbean
- POSIX regular expressions for Lua - Improved protocol parsing and encoding - Additional APIs for ZIP storage retrieval - Fix st_mode issue on NT for regular files - Generalized APIs for URL and Host handling - Worked out the kinks in resource resolution - Allow for custom error pages like /404.html
This commit is contained in:
parent
26ac6871da
commit
4effa23528
74 changed files with 3710 additions and 14246 deletions
|
@ -16,17 +16,21 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "net/http/escape.h"
|
||||
|
||||
/**
|
||||
* Escapes HTML entities.
|
||||
*
|
||||
* @param size if -1 implies strlen
|
||||
*/
|
||||
struct EscapeResult EscapeHtml(const char *data, size_t size) {
|
||||
int c;
|
||||
char *p;
|
||||
size_t i;
|
||||
struct EscapeResult r;
|
||||
if (size == -1) size = data ? strlen(data) : 0;
|
||||
p = r.data = xmalloc(size * 6 + 1);
|
||||
for (i = 0; i < size; ++i) {
|
||||
switch ((c = data[i])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue