XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions | Variables
https.cpp File Reference
#include "https.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <time.h>
#include <sys/socket.h>
#include <sys/netdb.h>
#include <arpa/inet.h>
#include <sys/_kefile.h>
#include <sys/_keproc.h>
#include <sys/_ketime.h>
#include "mbedtls/build_info.h"
#include "mbedtls/ssl.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/x509_crt.h"
Include dependency graph for https.cpp:

Classes

struct  xe_url
 
struct  xe_tls_slot
 
struct  xe_reader
 
struct  xe_cookie
 
struct  xe_many
 
struct  xe_warm_conn
 

Macros

#define XE_CLOCK_MIN   1577836800 /* 2020-01-01; epoch means the clock was never set */
 
#define XE_IDLE_MAX   150 /* 100 ms sleeps: 15 s */
 
#define XE_HDR_RAW   8192
 
#define XE_MAX_REDIRECTS   5
 
#define XE_CONNECT_PENDING   119
 
#define XE_COOKIE_MAX   32
 
#define XE_COOKIE_NAME   48
 
#define XE_COOKIE_VALUE   2048
 
#define XE_COOKIE_DOMAIN   128
 
#define XE_COOKIE_PATH   160
 
#define XE_JS_COOKIE_BUDGET   2032
 
#define XE_MANY_IDLE_MS   20000
 
#define XE_MANY_WAITS   750
 
#define XE_STEP_BUDGET   16384
 
#define XE_COLD_PER_HOST   2
 
#define XE_WARM_MAX   2
 

Enumerations

enum  {
  XJ_FREE = 0 , XJ_CONNECT , XJ_TLS , XJ_SEND ,
  XJ_HDR , XJ_BODY , XJ_DONE , XJ_FAIL ,
  XJ_WARM
}
 
enum  { XB_RAW = 0 , XB_LINE , XB_DATA , XB_CRLF }
 

Functions

void xe_http_response_free (xe_http_response *out)
 
void xe_http_set_referer (const char *url)
 
void xe_http_set_body (const char *content_type, const void *body, size_t len)
 
void xe_http_last_url (char *dst, size_t dstsz)
 
void xe_cookie_set (const char *page_url, const char *set_cookie, int from_http)
 
int xe_cookie_header (const char *url, char *dst, size_t dstsz)
 
int xe_cookie_document (const char *url, char *dst, size_t dstsz)
 
int xe_http_get_many (const char **urls, int n, const char *user_agent, xe_http_response *outs, const size_t *max_body, int *rcs)
 
int xe_http_get (const char *url, const char *method, const char *user_agent, xe_http_response *out, size_t max_body)
 

Variables

const unsigned char xe_cacert_pem []
 
const unsigned int xe_cacert_pem_len
 

Macro Definition Documentation

◆ XE_CLOCK_MIN

#define XE_CLOCK_MIN   1577836800 /* 2020-01-01; epoch means the clock was never set */

◆ XE_COLD_PER_HOST

#define XE_COLD_PER_HOST   2

◆ XE_CONNECT_PENDING

#define XE_CONNECT_PENDING   119

◆ XE_COOKIE_DOMAIN

#define XE_COOKIE_DOMAIN   128

◆ XE_COOKIE_MAX

#define XE_COOKIE_MAX   32

◆ XE_COOKIE_NAME

#define XE_COOKIE_NAME   48

◆ XE_COOKIE_PATH

#define XE_COOKIE_PATH   160

◆ XE_COOKIE_VALUE

#define XE_COOKIE_VALUE   2048

◆ XE_HDR_RAW

#define XE_HDR_RAW   8192

◆ XE_IDLE_MAX

#define XE_IDLE_MAX   150 /* 100 ms sleeps: 15 s */

◆ XE_JS_COOKIE_BUDGET

#define XE_JS_COOKIE_BUDGET   2032

◆ XE_MANY_IDLE_MS

#define XE_MANY_IDLE_MS   20000

◆ XE_MANY_WAITS

#define XE_MANY_WAITS   750

◆ XE_MAX_REDIRECTS

#define XE_MAX_REDIRECTS   5

◆ XE_STEP_BUDGET

#define XE_STEP_BUDGET   16384

◆ XE_WARM_MAX

#define XE_WARM_MAX   2

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
XJ_FREE 
XJ_CONNECT 
XJ_TLS 
XJ_SEND 
XJ_HDR 
XJ_BODY 
XJ_DONE 
XJ_FAIL 
XJ_WARM 

◆ anonymous enum

anonymous enum
Enumerator
XB_RAW 
XB_LINE 
XB_DATA 
XB_CRLF 

Function Documentation

◆ xe_cookie_document()

int xe_cookie_document ( const char *  url,
char *  dst,
size_t  dstsz 
)

◆ xe_cookie_header()

int xe_cookie_header ( const char *  url,
char *  dst,
size_t  dstsz 
)

◆ xe_cookie_set()

void xe_cookie_set ( const char *  page_url,
const char *  set_cookie,
int  from_http 
)

◆ xe_http_get()

int xe_http_get ( const char *  url,
const char *  method,
const char *  user_agent,
xe_http_response *  out,
size_t  max_body 
)

◆ xe_http_get_many()

int xe_http_get_many ( const char **  urls,
int  n,
const char *  user_agent,
xe_http_response *  outs,
const size_t *  max_body,
int *  rcs 
)

◆ xe_http_last_url()

void xe_http_last_url ( char *  dst,
size_t  dstsz 
)

◆ xe_http_response_free()

void xe_http_response_free ( xe_http_response *  out)

◆ xe_http_set_body()

void xe_http_set_body ( const char *  content_type,
const void *  body,
size_t  len 
)

◆ xe_http_set_referer()

void xe_http_set_referer ( const char *  url)

Variable Documentation

◆ xe_cacert_pem

const unsigned char xe_cacert_pem[]
extern

BSD 2-Clause License

Copyright (c) 2026, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ xe_cacert_pem_len

const unsigned int xe_cacert_pem_len
extern