mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Add HTTP/HTTPS Fetch() API to redbean
You can now say the following in your redbean Lua code: status,headers,payload = Fetch("https://foo.example") The following Lua APIs have been introduced: - Fetch(str) → str,{str:str},str - GetHttpReason(int) → str - GetHttpReason(int) → str - ProgramSslFetchVerify(bool) - ProgramSslClientVerify(bool) The following flags have been introduced: - `-j` enables client SSL verification - `-k` disables Fetch() SSL verification - `-t INT` may now be passed a negative value for keepalive Lua exceptions now invoke Cosmopolitan's garbage collector when unwinding the stack. So it's now safe to use _gc() w/ Lua 𝔱𝔥𝔯𝔬𝔴 See #97
This commit is contained in:
parent
36b2710e1a
commit
c89bc56f6a
35 changed files with 1611 additions and 591 deletions
9
third_party/mbedtls/x509_crt.c
vendored
9
third_party/mbedtls/x509_crt.c
vendored
|
@ -6,6 +6,7 @@
|
|||
#include "libc/limits.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "net/http/http.h"
|
||||
#include "third_party/mbedtls/common.h"
|
||||
#include "third_party/mbedtls/error.h"
|
||||
#include "third_party/mbedtls/oid.h"
|
||||
|
@ -2090,7 +2091,7 @@ static const struct x509_crt_verify_string x509_crt_verify_strings[] = {
|
|||
* terminated nul byte), or a negative error code.
|
||||
*/
|
||||
int mbedtls_x509_crt_verify_info( char *buf, size_t size, const char *prefix,
|
||||
uint32_t flags )
|
||||
uint32_t flags )
|
||||
{
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
const struct x509_crt_verify_string *cur;
|
||||
|
@ -2794,11 +2795,17 @@ static int x509_crt_check_cn( const mbedtls_x509_buf *name,
|
|||
static int x509_crt_check_san( const mbedtls_x509_buf *name,
|
||||
const char *cn, size_t cn_len )
|
||||
{
|
||||
int64_t ip;
|
||||
const unsigned char san_type = (unsigned char) name->tag &
|
||||
MBEDTLS_ASN1_TAG_VALUE_MASK;
|
||||
/* dNSName */
|
||||
if( san_type == MBEDTLS_X509_SAN_DNS_NAME )
|
||||
return( x509_crt_check_cn( name, cn, cn_len ) );
|
||||
if( san_type == MBEDTLS_X509_SAN_IP_ADDRESS &&
|
||||
name->len == 4 && ( ip = ParseIp( cn, cn_len ) ) != -1 &&
|
||||
ip == READ32BE( name->p ) ) {
|
||||
return( 0 );
|
||||
}
|
||||
/* (We may handle other types here later.) */
|
||||
/* Unrecognized type */
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue