2021-07-22 07:43:01 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2016-2020 Chung, Hyung-Hwan. 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 AUTHOR "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 AUTHOR 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _HIO_HTTP_H_
|
|
|
|
#define _HIO_HTTP_H_
|
|
|
|
|
|
|
|
#include <hio-ecs.h>
|
|
|
|
#include <hio-sck.h>
|
|
|
|
#include <hio-htre.h>
|
|
|
|
#include <hio-thr.h>
|
2022-09-12 14:43:29 +00:00
|
|
|
#include <hio-fcgi.h>
|
2021-07-22 07:43:01 +00:00
|
|
|
|
|
|
|
/** \file
|
|
|
|
* This file provides basic data types and functions for the http protocol.
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum hio_http_range_type_t
|
|
|
|
{
|
|
|
|
HIO_HTTP_RANGE_PROPER,
|
|
|
|
HIO_HTTP_RANGE_PREFIX,
|
|
|
|
HIO_HTTP_RANGE_SUFFIX
|
|
|
|
};
|
|
|
|
typedef enum hio_http_range_type_t hio_http_range_type_t;
|
|
|
|
/**
|
|
|
|
* The hio_http_range_t type defines a structure that can represent
|
2023-01-11 14:59:41 +00:00
|
|
|
* a value for the \b Range: http header.
|
2021-07-22 07:43:01 +00:00
|
|
|
*
|
2023-01-11 14:59:41 +00:00
|
|
|
* If type is #HIO_HTTP_RANGE_PREFIX, 'to' is meaningless and 'from' indicates
|
|
|
|
* the number of bytes from the start.
|
2021-07-22 07:43:01 +00:00
|
|
|
* - 500- => from the 501st bytes all the way to the back.
|
2023-01-11 14:59:41 +00:00
|
|
|
*
|
|
|
|
* If type is #HIO_HTTP_RANGE_SUFFIX, 'from' is meaningless and 'to' indicates
|
|
|
|
* the number of bytes from the back.
|
2021-07-22 07:43:01 +00:00
|
|
|
* - -500 => last 500 bytes
|
|
|
|
*
|
|
|
|
* If type is #HIO_HTTP_RANGE_PROPER, 'from' and 'to' represents a proper range
|
2023-01-11 14:59:41 +00:00
|
|
|
* where the value of 0 indicates the first byte. This doesn't require any
|
2021-07-22 07:43:01 +00:00
|
|
|
* adjustment.
|
|
|
|
* - 0-999 => first 1000 bytes
|
|
|
|
* - 99- => from the 100th bytes to the end.
|
|
|
|
*/
|
|
|
|
struct hio_http_range_t
|
|
|
|
{
|
|
|
|
hio_http_range_type_t type; /**< type indicator */
|
|
|
|
hio_foff_t from; /**< starting offset */
|
|
|
|
hio_foff_t to; /**< ending offset */
|
|
|
|
};
|
|
|
|
typedef struct hio_http_range_t hio_http_range_t;
|
|
|
|
|
|
|
|
enum hio_perenc_http_opt_t
|
|
|
|
{
|
|
|
|
HIO_PERENC_HTTP_KEEP_SLASH = (1 << 0)
|
|
|
|
};
|
|
|
|
typedef enum hio_perenc_http_opt_t hio_perenc_bcstr_opt_t;
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
typedef struct hio_svc_htts_t hio_svc_htts_t;
|
|
|
|
typedef struct hio_svc_httc_t hio_svc_httc_t;
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
|
2023-01-11 15:41:01 +00:00
|
|
|
typedef struct hio_svc_htts_task_t hio_svc_htts_task_t;
|
2021-07-22 07:43:01 +00:00
|
|
|
|
2023-01-11 15:41:01 +00:00
|
|
|
typedef void (*hio_svc_htts_task_on_kill_t) (
|
|
|
|
hio_svc_htts_task_t* task
|
2021-07-22 07:43:01 +00:00
|
|
|
);
|
|
|
|
|
2023-01-11 15:41:01 +00:00
|
|
|
#define HIO_SVC_HTTS_TASK_HEADER \
|
2021-07-22 07:43:01 +00:00
|
|
|
hio_svc_htts_t* htts; \
|
2023-01-11 15:41:01 +00:00
|
|
|
hio_oow_t task_size; \
|
|
|
|
hio_oow_t task_refcnt; \
|
|
|
|
hio_svc_htts_task_t* task_prev; \
|
|
|
|
hio_svc_htts_task_t* task_next; \
|
|
|
|
hio_svc_htts_task_on_kill_t task_on_kill
|
2021-07-22 07:43:01 +00:00
|
|
|
|
2023-01-11 15:41:01 +00:00
|
|
|
struct hio_svc_htts_task_t
|
2021-07-22 07:43:01 +00:00
|
|
|
{
|
2023-01-11 15:41:01 +00:00
|
|
|
HIO_SVC_HTTS_TASK_HEADER;
|
2021-07-22 07:43:01 +00:00
|
|
|
};
|
|
|
|
|
2023-01-11 15:41:01 +00:00
|
|
|
#define HIO_SVC_HTTS_TASK_REF(task, var) do { (var) = (task); ++(task)->task_refcnt; } while(0)
|
|
|
|
#define HIO_SVC_HTTS_TASK_UNREF(task_var) do { if (--(task_var)->task_refcnt == 0) { hio_svc_htts_task_t* __task_tmp = (task_var); (task_var) = HIO_NULL; hio_svc_htts_task_kill(__task_tmp); } else { (task_var) = HIO_NULL; } } while(0)
|
2021-07-22 07:43:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
|
|
|
|
typedef int (*hio_svc_htts_proc_req_t) (
|
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
hio_dev_sck_t* sck,
|
|
|
|
hio_htre_t* req
|
|
|
|
);
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
struct hio_svc_htts_thr_func_info_t
|
|
|
|
{
|
|
|
|
hio_http_method_t req_method;
|
|
|
|
hio_http_version_t req_version;
|
|
|
|
hio_bch_t* req_path;
|
|
|
|
hio_bch_t* req_param;
|
|
|
|
int req_x_http_method_override; /* -1 or hio_http_method_t */
|
|
|
|
|
|
|
|
/* TODO: header table */
|
|
|
|
|
|
|
|
hio_skad_t client_addr;
|
|
|
|
hio_skad_t server_addr;
|
|
|
|
};
|
|
|
|
typedef struct hio_svc_htts_thr_func_info_t hio_svc_htts_thr_func_info_t;
|
|
|
|
|
|
|
|
typedef void (*hio_svc_htts_thr_func_t) (
|
2023-01-11 14:59:41 +00:00
|
|
|
hio_svc_htts_t* htts,
|
2021-07-22 07:43:01 +00:00
|
|
|
hio_dev_thr_iopair_t* iop,
|
2022-10-25 22:47:40 +00:00
|
|
|
hio_svc_htts_thr_func_info_t* tfi,
|
2021-07-22 07:43:01 +00:00
|
|
|
void* ctx
|
|
|
|
);
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
|
2023-01-11 14:59:41 +00:00
|
|
|
struct hio_svc_htts_fun_func_info_t
|
|
|
|
{
|
|
|
|
hio_http_method_t req_method;
|
|
|
|
hio_http_version_t req_version;
|
|
|
|
hio_bch_t* req_path;
|
|
|
|
hio_bch_t* req_param;
|
|
|
|
int req_x_http_method_override; /* -1 or hio_http_method_t */
|
|
|
|
|
|
|
|
/* TODO: header table */
|
|
|
|
|
|
|
|
hio_skad_t client_addr;
|
|
|
|
hio_skad_t server_addr;
|
|
|
|
};
|
|
|
|
typedef struct hio_svc_htts_fun_func_info_t hio_svc_htts_fun_func_info_t;
|
|
|
|
|
|
|
|
typedef void (*hio_svc_htts_fun_func_t) (
|
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
void* ctx
|
|
|
|
);
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
|
2022-10-09 16:41:07 +00:00
|
|
|
enum hio_svc_htts_cgi_option_t
|
|
|
|
{
|
|
|
|
HIO_SVC_HTTS_CGI_NO_100_CONTINUE = (1 << 0)
|
|
|
|
};
|
|
|
|
|
2023-01-24 16:45:28 +00:00
|
|
|
enum hio_svc_htts_fcgi_option_t
|
|
|
|
{
|
|
|
|
HIO_SVC_HTTS_FCGI_NO_100_CONTINUE = (1 << 0)
|
|
|
|
};
|
|
|
|
|
2022-10-09 16:41:07 +00:00
|
|
|
enum hio_svc_htts_file_option_t
|
|
|
|
{
|
2022-12-21 14:57:51 +00:00
|
|
|
HIO_SVC_HTTS_FILE_NO_100_CONTINUE = (1 << 0),
|
2022-12-31 15:20:07 +00:00
|
|
|
HIO_SVC_HTTS_FILE_READ_ONLY = (1 << 1)
|
2022-10-09 16:41:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum hio_svc_htts_thr_option_t
|
|
|
|
{
|
|
|
|
HIO_SVC_HTTS_THR_NO_100_CONTINUE = (1 << 0)
|
|
|
|
};
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
enum hio_svc_htts_txt_option_t
|
|
|
|
{
|
|
|
|
/* no option yet */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2022-12-26 17:03:53 +00:00
|
|
|
enum hio_svc_htts_file_bfmt_dir_type_t
|
|
|
|
{
|
|
|
|
HIO_SVC_HTTS_FILE_BFMT_DIR_HEADER,
|
|
|
|
HIO_SVC_HTTS_FILE_BFMT_DIR_ENTRY,
|
|
|
|
HIO_SVC_HTTS_FILE_BFMT_DIR_FOOTER
|
|
|
|
};
|
|
|
|
typedef enum hio_svc_htts_file_bfmt_dir_type_t hio_svc_htts_file_bfmt_dir_type_t;
|
|
|
|
|
2022-12-21 14:57:52 +00:00
|
|
|
struct hio_svc_htts_file_cbs_t
|
|
|
|
{
|
2022-12-31 15:20:07 +00:00
|
|
|
const hio_bch_t* (*get_mime_type) (hio_svc_htts_t* htts, const hio_bch_t* qpath, const hio_bch_t* file_path, void* ctx);
|
|
|
|
int (*open_dir_list) (hio_svc_htts_t* htts, const hio_bch_t* qpath, const hio_bch_t* dir_path, const hio_bch_t** res_mime_type, void* ctx);
|
2022-12-23 14:44:55 +00:00
|
|
|
void *ctx;
|
2022-12-21 14:57:52 +00:00
|
|
|
};
|
|
|
|
typedef struct hio_svc_htts_file_cbs_t hio_svc_htts_file_cbs_t;
|
|
|
|
|
2021-07-22 07:43:01 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_comp_http_versions (
|
|
|
|
const hio_http_version_t* v1,
|
|
|
|
const hio_http_version_t* v2
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_comp_http_version_numbers (
|
|
|
|
const hio_http_version_t* v1,
|
|
|
|
int v2_major,
|
|
|
|
int v2_minor
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT const hio_bch_t* hio_http_status_to_bcstr (
|
|
|
|
int code
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT const hio_bch_t* hio_http_method_to_bcstr (
|
|
|
|
hio_http_method_t type
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT hio_http_method_t hio_bcstr_to_http_method (
|
|
|
|
const hio_bch_t* name
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT hio_http_method_t hio_bchars_to_http_method (
|
|
|
|
const hio_bch_t* nameptr,
|
|
|
|
hio_oow_t namelen
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_parse_http_range_bcstr (
|
|
|
|
const hio_bch_t* str,
|
|
|
|
hio_http_range_t* range
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_parse_http_time_bcstr (
|
|
|
|
const hio_bch_t* str,
|
|
|
|
hio_ntime_t* nt
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT hio_bch_t* hio_fmt_http_time_to_bcstr (
|
|
|
|
const hio_ntime_t* nt,
|
|
|
|
hio_bch_t* buf,
|
|
|
|
hio_oow_t bufsz
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The hio_is_perenced_http_bcstr() function determines if the given string
|
|
|
|
* contains a valid percent-encoded sequence.
|
|
|
|
*/
|
|
|
|
HIO_EXPORT int hio_is_perenced_http_bcstr (
|
|
|
|
const hio_bch_t* str
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The hio_perdec_http_bcstr() function performs percent-decoding over a string.
|
|
|
|
* The caller must ensure that the output buffer \a buf is large enough.
|
|
|
|
* If \a ndecs is not #HIO_NULL, it is set to the number of characters
|
2022-12-31 15:52:38 +00:00
|
|
|
* decoded. 0 means no characters in the input string required decoding
|
2021-07-22 07:43:01 +00:00
|
|
|
* \return the length of the output string.
|
|
|
|
*/
|
|
|
|
HIO_EXPORT hio_oow_t hio_perdec_http_bcstr (
|
2023-01-11 14:59:41 +00:00
|
|
|
const hio_bch_t* str,
|
2021-07-22 07:43:01 +00:00
|
|
|
hio_bch_t* buf,
|
|
|
|
hio_oow_t* ndecs
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The hio_perdec_http_bcstr() function performs percent-decoding over a length-bound string.
|
|
|
|
* It doesn't insert the terminating null.
|
|
|
|
*/
|
|
|
|
HIO_EXPORT hio_oow_t hio_perdec_http_bcs (
|
2023-01-11 14:59:41 +00:00
|
|
|
const hio_bcs_t* str,
|
2021-07-22 07:43:01 +00:00
|
|
|
hio_bch_t* buf,
|
|
|
|
hio_oow_t* ndecs
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The hio_perenc_http_bcstr() function performs percent-encoding over a string.
|
2023-01-02 15:36:14 +00:00
|
|
|
* It returns the length of the encoded string if \a len is long enough to hold
|
|
|
|
* the resulting string and the terminating null. If the return value is equal to
|
|
|
|
* or greater than \a len, the buffer pointed to by \a buf of the length \a len
|
|
|
|
* is not large enough.
|
|
|
|
* \return the length of the output string encoded on success or the number of encoded
|
|
|
|
* string that would have been written if the buffer has been large enough.
|
2021-07-22 07:43:01 +00:00
|
|
|
*/
|
|
|
|
HIO_EXPORT hio_oow_t hio_perenc_http_bcstr (
|
2023-01-11 14:59:41 +00:00
|
|
|
const hio_bch_t* str,
|
2021-07-22 07:43:01 +00:00
|
|
|
hio_bch_t* buf,
|
2023-01-02 15:36:14 +00:00
|
|
|
hio_oow_t len,
|
|
|
|
int opt /**< 0 or bitwise-OR'ed of #hio_perenc_http_bcstr_opt_t */
|
2021-07-22 07:43:01 +00:00
|
|
|
);
|
|
|
|
|
2023-01-02 15:36:14 +00:00
|
|
|
/**
|
|
|
|
* The hio_perenc_http_bchars() function performs percent-ending over a length-bound string.
|
|
|
|
* It doesn't null-terminate the result. The buffer requirement is less than hio_perenc_http_bcstr()
|
|
|
|
* by 1.
|
|
|
|
*/
|
|
|
|
HIO_EXPORT hio_oow_t hio_perenc_http_bchars (
|
|
|
|
const hio_bch_t* str,
|
|
|
|
hio_oow_t sln,
|
|
|
|
hio_bch_t* buf,
|
|
|
|
hio_oow_t len,
|
|
|
|
int opt /**< 0 or bitwise-OR'ed of #hio_perenc_http_bcstr_opt_t */
|
2021-07-22 07:43:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_scan_http_qparam (
|
|
|
|
hio_bch_t* qparam,
|
|
|
|
int (*qparamcb) (hio_bcs_t* key, hio_bcs_t* val, void* ctx),
|
|
|
|
void* ctx
|
|
|
|
);
|
|
|
|
|
2023-01-02 15:36:14 +00:00
|
|
|
HIO_EXPORT hio_oow_t hio_escape_html_bchars (
|
|
|
|
const hio_bch_t* str,
|
|
|
|
hio_oow_t sln,
|
|
|
|
hio_bch_t* buf,
|
|
|
|
hio_oow_t len
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT hio_oow_t hio_escape_html_bcstr (
|
|
|
|
const hio_bch_t* str,
|
|
|
|
hio_bch_t* buf,
|
|
|
|
hio_oow_t len
|
|
|
|
);
|
2023-01-11 14:59:41 +00:00
|
|
|
|
2021-07-22 07:43:01 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* HTTP SERVER SERVICE */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
HIO_EXPORT hio_svc_htts_t* hio_svc_htts_start (
|
|
|
|
hio_t* hio,
|
2022-10-07 05:08:40 +00:00
|
|
|
hio_oow_t xtnsize,
|
2021-08-06 03:23:48 +00:00
|
|
|
hio_dev_sck_bind_t* binds,
|
|
|
|
hio_oow_t nbinds,
|
2021-07-22 07:43:01 +00:00
|
|
|
hio_svc_htts_proc_req_t proc_req
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT void hio_svc_htts_stop (
|
|
|
|
hio_svc_htts_t* htts
|
|
|
|
);
|
|
|
|
|
2022-10-07 05:08:40 +00:00
|
|
|
HIO_EXPORT void* hio_svc_htts_getxtn (
|
|
|
|
hio_svc_htts_t* htts
|
|
|
|
);
|
|
|
|
|
2021-07-22 07:43:01 +00:00
|
|
|
#if defined(HIO_HAVE_INLINE)
|
|
|
|
static HIO_INLINE hio_t* hio_svc_htts_gethio(hio_svc_htts_t* svc) { return hio_svc_gethio((hio_svc_t*)svc); }
|
|
|
|
#else
|
|
|
|
# define hio_svc_htts_gethio(svc) hio_svc_gethio(svc)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_svc_htts_writetosidechan (
|
|
|
|
hio_svc_htts_t* htts,
|
2021-08-06 03:23:48 +00:00
|
|
|
hio_oow_t idx, /* listener index */
|
2021-07-22 07:43:01 +00:00
|
|
|
const void* dptr,
|
|
|
|
hio_oow_t dlen
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_svc_htts_setservernamewithbcstr (
|
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
const hio_bch_t* server_name
|
|
|
|
);
|
|
|
|
|
2021-08-06 03:23:48 +00:00
|
|
|
/* return the listening device at the given position.
|
|
|
|
* not all devices may be up and running */
|
|
|
|
HIO_EXPORT hio_dev_sck_t* hio_svc_htts_getlistendev (
|
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
hio_oow_t idx
|
|
|
|
);
|
|
|
|
|
|
|
|
/* return the total number of listening devices requested to start.
|
|
|
|
* not all devices may be up and running */
|
|
|
|
HIO_EXPORT hio_oow_t hio_sv_htts_getnlistendevs (
|
|
|
|
hio_svc_htts_t* htts
|
|
|
|
);
|
|
|
|
|
2021-07-22 07:43:01 +00:00
|
|
|
HIO_EXPORT int hio_svc_htts_getsockaddr (
|
|
|
|
hio_svc_htts_t* htts,
|
2021-08-06 03:23:48 +00:00
|
|
|
hio_oow_t idx, /* listener index */
|
2021-07-22 07:43:01 +00:00
|
|
|
hio_skad_t* skad
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_svc_htts_docgi (
|
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
hio_dev_sck_t* csck,
|
|
|
|
hio_htre_t* req,
|
|
|
|
const hio_bch_t* docroot,
|
2022-10-09 16:41:07 +00:00
|
|
|
const hio_bch_t* script,
|
|
|
|
int options
|
2021-07-22 07:43:01 +00:00
|
|
|
);
|
|
|
|
|
2022-09-12 14:43:29 +00:00
|
|
|
HIO_EXPORT int hio_svc_htts_dofcgi (
|
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
hio_dev_sck_t* csck,
|
|
|
|
hio_htre_t* req,
|
2022-10-09 16:41:07 +00:00
|
|
|
const hio_skad_t* fcgis_addr,
|
2023-01-11 14:59:41 +00:00
|
|
|
const hio_bch_t* docroot,
|
|
|
|
const hio_bch_t* script,
|
2022-12-21 14:57:52 +00:00
|
|
|
int options /**< 0 or bitwise-Ored of #hio_svc_htts_file_option_t enumerators */
|
2022-09-12 14:43:29 +00:00
|
|
|
);
|
|
|
|
|
2021-07-22 07:43:01 +00:00
|
|
|
HIO_EXPORT int hio_svc_htts_dofile (
|
2022-12-21 14:57:52 +00:00
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
hio_dev_sck_t* csck,
|
|
|
|
hio_htre_t* req,
|
|
|
|
const hio_bch_t* docroot,
|
|
|
|
const hio_bch_t* filepath,
|
|
|
|
const hio_bch_t* mime_type,
|
|
|
|
int options,
|
|
|
|
hio_svc_htts_file_cbs_t* cbs
|
2021-07-22 07:43:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_svc_htts_dothr (
|
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
hio_dev_sck_t* csck,
|
|
|
|
hio_htre_t* req,
|
|
|
|
hio_svc_htts_thr_func_t func,
|
2022-10-09 16:41:07 +00:00
|
|
|
void* ctx,
|
|
|
|
int options
|
2021-07-22 07:43:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT int hio_svc_htts_dotxt (
|
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
hio_dev_sck_t* csck,
|
|
|
|
hio_htre_t* req,
|
|
|
|
int status_code,
|
|
|
|
const hio_bch_t* content_type,
|
2022-10-09 16:41:07 +00:00
|
|
|
const hio_bch_t* content_text,
|
|
|
|
int options
|
2021-07-22 07:43:01 +00:00
|
|
|
);
|
|
|
|
|
2023-01-11 15:41:01 +00:00
|
|
|
HIO_EXPORT hio_svc_htts_task_t* hio_svc_htts_task_make (
|
2021-07-22 07:43:01 +00:00
|
|
|
hio_svc_htts_t* htts,
|
2023-01-11 15:41:01 +00:00
|
|
|
hio_oow_t task_size,
|
|
|
|
hio_svc_htts_task_on_kill_t on_kill
|
2021-07-22 07:43:01 +00:00
|
|
|
);
|
|
|
|
|
2023-01-11 15:41:01 +00:00
|
|
|
HIO_EXPORT void hio_svc_htts_task_kill (
|
|
|
|
hio_svc_htts_task_t* task
|
2021-07-22 07:43:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
HIO_EXPORT void hio_svc_htts_fmtgmtime (
|
2023-01-11 14:59:41 +00:00
|
|
|
hio_svc_htts_t* htts,
|
2021-07-22 07:43:01 +00:00
|
|
|
const hio_ntime_t* nt,
|
|
|
|
hio_bch_t* buf,
|
|
|
|
hio_oow_t len
|
|
|
|
);
|
|
|
|
|
|
|
|
HIO_EXPORT hio_bch_t* hio_svc_htts_dupmergepaths (
|
|
|
|
hio_svc_htts_t* htts,
|
|
|
|
const hio_bch_t* base,
|
|
|
|
const hio_bch_t* path
|
|
|
|
);
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|