touched up code a bit for building with watcom.
This commit is contained in:
parent
45cb237aa6
commit
0962885749
@ -21,6 +21,11 @@
|
|||||||
#ifndef _QSE_CMN_NWAD_H_
|
#ifndef _QSE_CMN_NWAD_H_
|
||||||
#define _QSE_CMN_NWAD_H_
|
#define _QSE_CMN_NWAD_H_
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* This file defines functions and data types for handling
|
||||||
|
* a network address and a socket address.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <qse/types.h>
|
#include <qse/types.h>
|
||||||
#include <qse/macros.h>
|
#include <qse/macros.h>
|
||||||
#include <qse/cmn/ipad.h>
|
#include <qse/cmn/ipad.h>
|
||||||
@ -38,9 +43,14 @@ typedef struct qse_nwad_t qse_nwad_t;
|
|||||||
|
|
||||||
#define QSE_NWAD_LOCAL_MAX_PATH 128
|
#define QSE_NWAD_LOCAL_MAX_PATH 128
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_nwad_t type defines a structure to hold a network address.
|
||||||
|
*/
|
||||||
struct qse_nwad_t
|
struct qse_nwad_t
|
||||||
{
|
{
|
||||||
|
/** network address type */
|
||||||
qse_nwad_type_t type;
|
qse_nwad_type_t type;
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
@ -65,7 +75,7 @@ struct qse_nwad_t
|
|||||||
* trailers may get truncated, when itconverted to skad. */
|
* trailers may get truncated, when itconverted to skad. */
|
||||||
qse_char_t path[QSE_NWAD_LOCAL_MAX_PATH];
|
qse_char_t path[QSE_NWAD_LOCAL_MAX_PATH];
|
||||||
} local;
|
} local;
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum qse_nwadtostr_flag_t
|
enum qse_nwadtostr_flag_t
|
||||||
@ -86,6 +96,10 @@ typedef enum qse_nwadtostr_flag_t qse_nwadtostr_flag_t;
|
|||||||
|
|
||||||
typedef struct qse_skad_t qse_skad_t;
|
typedef struct qse_skad_t qse_skad_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_skad_t type defines a structure large enough to hold a socket
|
||||||
|
* address.
|
||||||
|
*/
|
||||||
struct qse_skad_t
|
struct qse_skad_t
|
||||||
{
|
{
|
||||||
#define QSE_SKAD_DATA_SIZE 0
|
#define QSE_SKAD_DATA_SIZE 0
|
||||||
@ -132,15 +146,27 @@ QSE_EXPORT void qse_clearnwad (
|
|||||||
qse_nwad_type_t type
|
qse_nwad_type_t type
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_setnwadport() function changes the port number field of a
|
||||||
|
* network saddress.
|
||||||
|
*/
|
||||||
QSE_EXPORT void qse_setnwadport (
|
QSE_EXPORT void qse_setnwadport (
|
||||||
qse_nwad_t* nwad,
|
qse_nwad_t* nwad,
|
||||||
qse_uint16_t port
|
qse_uint16_t port
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_getnwadport() function returns the port number field of a
|
||||||
|
* network address.
|
||||||
|
*/
|
||||||
QSE_EXPORT qse_uint16_t qse_getnwadport (
|
QSE_EXPORT qse_uint16_t qse_getnwadport (
|
||||||
qse_nwad_t* nwad
|
qse_nwad_t* nwad
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_mbstonwad() function converts a multi-byte string \a mbs to a
|
||||||
|
* network address and stores it to memory pointed to by \a nwad.
|
||||||
|
*/
|
||||||
QSE_EXPORT int qse_mbstonwad (
|
QSE_EXPORT int qse_mbstonwad (
|
||||||
const qse_mchar_t* mbs,
|
const qse_mchar_t* mbs,
|
||||||
qse_nwad_t* nwad
|
qse_nwad_t* nwad
|
||||||
@ -187,16 +213,30 @@ QSE_EXPORT qse_size_t qse_nwadtowcs (
|
|||||||
# define qse_nwadtostr(nwad,ptr,len,flags) qse_nwadtowcs(nwad,ptr,len,flags)
|
# define qse_nwadtostr(nwad,ptr,len,flags) qse_nwadtowcs(nwad,ptr,len,flags)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_skadtonwad() function converts a socket address \a skad
|
||||||
|
* to a network address and stroes it to memory pointed to by \a nwad.
|
||||||
|
* \return -1 upon failure, size of the socket address in success.
|
||||||
|
*/
|
||||||
QSE_EXPORT int qse_skadtonwad (
|
QSE_EXPORT int qse_skadtonwad (
|
||||||
const qse_skad_t* skad,
|
const qse_skad_t* skad,
|
||||||
qse_nwad_t* nwad
|
qse_nwad_t* nwad
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_nwadtoskad() function converts a network address \a nwad
|
||||||
|
* to a socket address and stores it to memory pointed to by \a skad.
|
||||||
|
* \return -1 upon failure, size of the socket address in success.
|
||||||
|
*/
|
||||||
QSE_EXPORT int qse_nwadtoskad (
|
QSE_EXPORT int qse_nwadtoskad (
|
||||||
const qse_nwad_t* nwad,
|
const qse_nwad_t* nwad,
|
||||||
qse_skad_t* skad
|
qse_skad_t* skad
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_skadfamily() function returns the socket address family
|
||||||
|
* of a given address \a skad.
|
||||||
|
*/
|
||||||
QSE_EXPORT int qse_skadfamily (
|
QSE_EXPORT int qse_skadfamily (
|
||||||
const qse_skad_t* skad
|
const qse_skad_t* skad
|
||||||
);
|
);
|
||||||
|
@ -25,13 +25,7 @@
|
|||||||
#include <qse/cmn/sio.h>
|
#include <qse/cmn/sio.h>
|
||||||
|
|
||||||
/** \file
|
/** \file
|
||||||
* This file defines functions and data types that help you create
|
* This file provides easier interface to a qse_xli_t object.
|
||||||
* an xli interpreter with less effort. It is designed to be as close
|
|
||||||
* to conventional xli implementations as possible.
|
|
||||||
*
|
|
||||||
* The source script handler does not evaluate a file name of the "var=val"
|
|
||||||
* form as an assignment expression. Instead, it just treats it as a
|
|
||||||
* normal file name.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +21,23 @@
|
|||||||
#ifndef _QSE_XLI_XLI_H_
|
#ifndef _QSE_XLI_XLI_H_
|
||||||
#define _QSE_XLI_XLI_H_
|
#define _QSE_XLI_XLI_H_
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* This file defines functions and data types for handling key-value pairs
|
||||||
|
* orgianized in the way shown below.
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* key1 = "abc";
|
||||||
|
* key2 {
|
||||||
|
* key21 = "hello";
|
||||||
|
* key22 = "world";
|
||||||
|
* key23 {
|
||||||
|
* key231 = 99999;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* key3 = "12345";
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
|
||||||
#include <qse/types.h>
|
#include <qse/types.h>
|
||||||
#include <qse/macros.h>
|
#include <qse/macros.h>
|
||||||
|
|
||||||
@ -81,7 +98,7 @@ enum qse_xli_opt_t
|
|||||||
QSE_XLI_PAIRXTNSIZE,
|
QSE_XLI_PAIRXTNSIZE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the size of extension area associated with the root list node.
|
* The size of extension area associated with the root list node.
|
||||||
* you can get the pointer to the extension with qse_getxlirootxtn().
|
* you can get the pointer to the extension with qse_getxlirootxtn().
|
||||||
* the new size set takes effect after the call to qse_xli_yieldroot().
|
* the new size set takes effect after the call to qse_xli_yieldroot().
|
||||||
*/
|
*/
|
||||||
|
@ -1509,14 +1509,14 @@ static int task_main_cgi (
|
|||||||
x = qse_pio_init (
|
x = qse_pio_init (
|
||||||
&cgi->pio, httpd->mmgr, (const qse_char_t*)xpath,
|
&cgi->pio, httpd->mmgr, (const qse_char_t*)xpath,
|
||||||
cgi->env, pio_options);
|
cgi->env, pio_options);
|
||||||
if (xpath != cgi->path && xpath != &cgi->fnc) QSE_MMGR_FREE (httpd->mmgr, xpath);
|
if (xpath != cgi->path &&
|
||||||
|
xpath != (qse_mchar_t*)&cgi->fnc) QSE_MMGR_FREE (httpd->mmgr, xpath);
|
||||||
|
|
||||||
if (x <= -1)
|
if (x <= -1)
|
||||||
{
|
{
|
||||||
qse_pio_errnum_t errnum;
|
qse_pio_errnum_t errnum;
|
||||||
|
|
||||||
errnum = qse_pio_geterrnum (&cgi->pio);
|
errnum = qse_pio_geterrnum (&cgi->pio);
|
||||||
|
|
||||||
if (errnum == QSE_PIO_ENOENT) http_errnum = 404;
|
if (errnum == QSE_PIO_ENOENT) http_errnum = 404;
|
||||||
else if (errnum == QSE_PIO_EACCES) http_errnum = 403;
|
else if (errnum == QSE_PIO_EACCES) http_errnum = 403;
|
||||||
|
|
||||||
@ -1674,4 +1674,3 @@ qse_httpd_task_t* qse_httpd_entaskcgi (
|
|||||||
((arg.shebang.len + 1) * QSE_SIZEOF(*arg.shebang.ptr))
|
((arg.shebang.len + 1) * QSE_SIZEOF(*arg.shebang.ptr))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,7 +1053,10 @@ static int task_init_proxy (
|
|||||||
{
|
{
|
||||||
/* the query path has been percent-decoded. get the original qpath*/
|
/* the query path has been percent-decoded. get the original qpath*/
|
||||||
|
|
||||||
/*
|
#if 0
|
||||||
|
/* percent-encoding back doesn't work all the time because
|
||||||
|
* some characters not encoded in the original request may get
|
||||||
|
* encoded. some picky servers has thrown errors for such requests */
|
||||||
qse_mchar_t* qpath, * qpath_enc;
|
qse_mchar_t* qpath, * qpath_enc;
|
||||||
qse_size_t x;
|
qse_size_t x;
|
||||||
|
|
||||||
@ -1066,9 +1069,10 @@ static int task_init_proxy (
|
|||||||
if (qpath != qpath_enc) QSE_MMGR_FREE (httpd->mmgr, qpath_enc);
|
if (qpath != qpath_enc) QSE_MMGR_FREE (httpd->mmgr, qpath_enc);
|
||||||
|
|
||||||
if (x == (qse_size_t)-1) goto nomem_oops;
|
if (x == (qse_size_t)-1) goto nomem_oops;
|
||||||
*/
|
#else
|
||||||
|
/* using the original query path minimizes the chance of side-effects */
|
||||||
if (qse_mbs_cat (proxy->reqfwdbuf, qse_htre_getorgqpath(arg->req)) == (qse_size_t)-1) goto nomem_oops;
|
if (qse_mbs_cat (proxy->reqfwdbuf, qse_htre_getorgqpath(arg->req)) == (qse_size_t)-1) goto nomem_oops;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user