mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Restore Referer-Policy and wrap up MbedTLS changes
redbean will now set Referer-Policy to no-referrer-when-downgrade on text/html responses by default. There's better explanations on the bits of security redbean is offering. In short, it's 128+ for modern clients and 112+ for legacy. If the -B flag is used then it's 192+ for modern and 150+ for non-EC.
This commit is contained in:
parent
344d2dc356
commit
df8ab0aa0c
32 changed files with 679 additions and 663 deletions
|
@ -1,6 +1,9 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_STDIO_APPEND_INTERNAL_H_
|
||||
#define COSMOPOLITAN_LIBC_STDIO_APPEND_INTERNAL_H_
|
||||
#include "libc/fmt/pflink.h"
|
||||
|
||||
#define APPEND_COOKIE 21578
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
|
@ -13,6 +16,7 @@ int appendf(char **, const char *, ...);
|
|||
int vappendf(char **, const char *, va_list);
|
||||
int appends(char **, const char *);
|
||||
int appendd(char **, const void *, size_t);
|
||||
int appendw(char **, uint64_t);
|
||||
struct appendz appendz(char *);
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
|
|
|
@ -44,7 +44,7 @@ int appendd(char **b, const void *s, size_t l) {
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
memcpy(p + z.i, s, l + 1);
|
||||
*(char *)mempcpy(p + z.i, s, l) = 0;
|
||||
z.i += l;
|
||||
if (!IsTiny() && W == 8) {
|
||||
z.i |= (size_t)APPEND_COOKIE << 48;
|
||||
|
|
33
libc/stdio/appendw.c
Normal file
33
libc/stdio/appendw.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/nexgen32e/bsr.h"
|
||||
#include "libc/stdio/append.internal.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
||||
/**
|
||||
* Appends string to buffer.
|
||||
*/
|
||||
int appendw(char **b, uint64_t w) {
|
||||
char t[8];
|
||||
unsigned l;
|
||||
if (!w) return 0;
|
||||
WRITE64LE(t, w);
|
||||
return appendd(b, t, (bsrl(w) >> 3) + 1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue