From 056cff9192a479bbfcba5f603cd61e2246ed9d13 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 25 Sep 2014 15:27:08 +0000 Subject: [PATCH] changed configure.ac to detect dirfd() and related stuffs. changed lib/cmn/syscall.h to use DIRFD related macros produced by configure --- qse/cmd/http/httpd.c | 4 +- qse/configure | 23 ++++++++++- qse/configure.ac | 3 +- qse/include/qse/cmn/nwad.h | 12 +++++- qse/include/qse/cmn/pio.h | 74 ++++++++++++++++++++---------------- qse/include/qse/config.h.in | 9 +++++ qse/include/qse/http/httpd.h | 4 +- qse/lib/cmn/mux.c | 11 +++++- qse/lib/cmn/nwad.c | 2 +- qse/lib/cmn/pio.c | 6 +++ qse/lib/cmn/sck.c | 8 ++++ qse/lib/cmn/syscall.h | 10 ++++- qse/lib/http/httpd-std-dns.h | 4 +- qse/lib/http/httpd-std-urs.h | 13 +++++-- qse/lib/http/httpd-std.c | 8 ++-- 15 files changed, 137 insertions(+), 54 deletions(-) diff --git a/qse/cmd/http/httpd.c b/qse/cmd/http/httpd.c index fae42b62..2d5e43c3 100644 --- a/qse/cmd/http/httpd.c +++ b/qse/cmd/http/httpd.c @@ -537,7 +537,7 @@ static int get_server_root ( root->type = QSE_HTTPD_SERVERSTD_ROOT_PROXY; if (loccfg->proxy.pseudonym[0]) - root->u.proxy.pseudonym = loccfg->proxy.pseudonym; + root->u.proxy.pseudonym = loccfg->proxy.pseudonym; /* move the host name part backward by 1 byte to make a room for * terminating null. An orginal input of http://www.yahoo.com/ab/cd @@ -1877,7 +1877,7 @@ static int load_hook_modules (qse_httpd_t* httpd, qse_xli_list_t* hook_list) pair = qse_xli_findpair (httpd_xtn->xli, (qse_xli_list_t*)pair->val, QSE_T("file")); if (pair == QSE_NULL) { - /* TODO: log warning when file is not found in module */ + /* TODO: log warning when file is not found in module */ } else { diff --git a/qse/configure b/qse/configure index 2ae1f073..698058f1 100755 --- a/qse/configure +++ b/qse/configure @@ -17575,7 +17575,7 @@ _ACEOF fi done -for ac_func in lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64 +for ac_func in lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64 dirfd do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -18780,6 +18780,27 @@ _ACEOF fi +ac_fn_c_check_member "$LINENO" "DIR" "d_fd" "ac_cv_member_DIR_d_fd" "#include +" +if test "x$ac_cv_member_DIR_d_fd" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_DIR_D_FD 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "DIR" "dd_fd" "ac_cv_member_DIR_dd_fd" "#include +" +if test "x$ac_cv_member_DIR_dd_fd" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_DIR_DD_FD 1 +_ACEOF + + +fi + ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then : diff --git a/qse/configure.ac b/qse/configure.ac index 732e38be..a477da3d 100644 --- a/qse/configure.ac +++ b/qse/configure.ac @@ -143,7 +143,7 @@ AC_CHECK_FUNCS([mbrlen mbrtowc wcrtomb]) AC_CHECK_FUNCS([mbsnrtowcs mbsrtowcs wcsnrtombs wcsrtombs]) AC_CHECK_FUNCS([wctype iswctype wctrans towctrans]) AC_CHECK_FUNCS([isblank iswblank]) -AC_CHECK_FUNCS([lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64]) +AC_CHECK_FUNCS([lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64 dirfd]) AC_CHECK_FUNCS([timegm timelocal]) AC_CHECK_FUNCS([utime utimes]) AC_CHECK_FUNCS([sysconf prctl fdopendir setrlimit getrlimit]) @@ -282,6 +282,7 @@ AC_SUBST(UCI_LIBS) AM_CONDITIONAL(HAVE_LIBUCI, test "${ac_cv_lib_uci_uci_alloc_context}" = "yes" -a "${ac_cv_header_uci_h}" = "yes") AC_STRUCT_DIRENT_D_TYPE +AC_CHECK_MEMBERS([DIR.d_fd, DIR.dd_fd],,,[[#include ]]) AC_CHECK_MEMBERS([struct stat.st_birthtime]) AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec]) diff --git a/qse/include/qse/cmn/nwad.h b/qse/include/qse/cmn/nwad.h index f16d297d..e2bd981c 100644 --- a/qse/include/qse/cmn/nwad.h +++ b/qse/include/qse/cmn/nwad.h @@ -29,7 +29,8 @@ enum qse_nwad_type_t { QSE_NWAD_NX, /* non-existent */ QSE_NWAD_IN4, - QSE_NWAD_IN6 + QSE_NWAD_IN6, + QSE_NWAD_LOCAL }; typedef enum qse_nwad_type_t qse_nwad_type_t; @@ -51,7 +52,13 @@ struct qse_nwad_t qse_uint16_t port; qse_ip6ad_t addr; qse_uint32_t scope; - } in6; + } in6; + + struct + { + /* no port number. path is the address */ + qse_uint8_t path[64]; + } local; } u; }; @@ -69,6 +76,7 @@ enum qse_nwadtostr_flag_t #define QSE_NWADTOMBS_ALL QSE_NWADTOSTR_ALL #define QSE_NWADTOWCS_ALL QSE_NWADTOSTR_ALL }; +typedef enum qse_nwadtostr_flag_t qse_nwadtostr_flag_t; typedef struct qse_skad_t qse_skad_t; diff --git a/qse/include/qse/cmn/pio.h b/qse/include/qse/cmn/pio.h index 77e0a8fc..7594d008 100644 --- a/qse/include/qse/cmn/pio.h +++ b/qse/include/qse/cmn/pio.h @@ -26,7 +26,7 @@ #include #include -/** @file +/** \file * This file defines a piped interface to a child process. You can execute * a child process, read and write to its stdin, stdout, stderr, and terminate * it. It provides more advanced interface than popen() and pclose(). @@ -59,8 +59,9 @@ enum qse_pio_flag_t * them to prevent inheritance. */ QSE_PIO_NOCLOEXEC = (1 << 5), - /** indidate that the command to qse_pio_open() is a pointer to - * #qse_pio_fnc_t. supported on unix/linux only */ + /** indidate that the command to qse_pio_open()/qse_pio_init() is + * a pointer to a #qse_pio_fnc_t structure. supported on unix/linux + * only */ QSE_PIO_FNCCMD = (1 << 6), /** write to stdin of a child process */ @@ -99,11 +100,11 @@ enum qse_pio_flag_t QSE_PIO_WAITNORETRY = (1 << 24), /** put stdin to non-blocking mode (only on supported platforms) */ - QSE_PIO_INNOBLOCK = (1 << 25), + QSE_PIO_INNOBLOCK = (1 << 25), /** put stdout to non-blocking mode (only on supported platforms)*/ - QSE_PIO_OUTNOBLOCK = (1 << 26), + QSE_PIO_OUTNOBLOCK = (1 << 26), /** put stderr to non-blocking mode (only on supported platforms) */ - QSE_PIO_ERRNOBLOCK = (1 << 27) + QSE_PIO_ERRNOBLOCK = (1 << 27) }; /** @@ -120,6 +121,10 @@ typedef enum qse_pio_hid_t qse_pio_hid_t; typedef int (*qse_pio_fncptr_t) (void* ctx, qse_env_char_t** envir); +/** + * The qse_pio_fnc_t type defines a structure to point to the function + * executed in a child process when #QSE_PIO_FNCCMD is specified. + */ typedef struct qse_pio_fnc_t qse_pio_fnc_t; struct qse_pio_fnc_t { @@ -206,9 +211,9 @@ struct qse_pio_t qse_pio_pin_t pin[3]; }; -/** access the @a errnum field of the #qse_pio_t structure */ +/** access the \a errnum field of the #qse_pio_t structure */ #define QSE_PIO_ERRNUM(pio) ((pio)->errnum) -/** access the @a child field of the #qse_pio_t structure */ +/** access the \a child field of the #qse_pio_t structure */ #define QSE_PIO_CHILD(pio) ((pio)->child) /** get the native handle from the #qse_pio_t structure */ #define QSE_PIO_HANDLE(pio,hid) ((pio)->pin[hid].handle) @@ -218,16 +223,16 @@ extern "C" { #endif /** - * The qse_pio_open() function executes a command @a cmd and establishes - * pipes to it. #QSE_PIO_SHELL causes the function to execute @a cmd via + * The qse_pio_open() function executes a command \a cmd and establishes + * pipes to it. #QSE_PIO_SHELL causes the function to execute \a cmd via * the default shell of an underlying system: /bin/sh on *nix, cmd.exe on win32. * On *nix systems, a full path to the command is needed if it is not specified. - * If @a env is #QSE_NULL, the environment of @a cmd inherits that of the + * If \a env is #QSE_NULL, the environment of \a cmd inherits that of the * calling process. If you want to pass an empty environment, you can pass - * an empty @a env object with no items inserted. If #QSE_PIO_MBSCMD is - * specified in @a flags, @a cmd is treated as a multi-byte string whose + * an empty \a env object with no items inserted. If #QSE_PIO_MBSCMD is + * specified in \a flags, \a cmd is treated as a multi-byte string whose * character type is #qse_mchar_t. - * @return #qse_pio_t object on success, #QSE_NULL on failure + * \return #qse_pio_t object on success, #QSE_NULL on failure */ QSE_EXPORT qse_pio_t* qse_pio_open ( qse_mmgr_t* mmgr, /**< memory manager */ @@ -250,7 +255,7 @@ QSE_EXPORT void qse_pio_close ( * The qse_pio_init() functions performs the same task as the qse_pio_open() * except that you need to allocate a #qse_pio_t structure and pass it to the * function. - * @return 0 on success, -1 on failure + * \return 0 on success, -1 on failure */ QSE_EXPORT int qse_pio_init ( qse_pio_t* pio, /**< pio object */ @@ -263,7 +268,7 @@ QSE_EXPORT int qse_pio_init ( /** * The qse_pio_fini() function performs the same task as qse_pio_close() - * except that it does not destroy a #qse_pio_t structure pointed to by @a pio. + * except that it does not destroy a #qse_pio_t structure pointed to by \a pio. */ QSE_EXPORT void qse_pio_fini ( qse_pio_t* pio /**< pio object */ @@ -280,7 +285,7 @@ QSE_EXPORT void* qse_pio_getxtn ( /** * The qse_pio_geterrnum() function returns the number of the last error * occurred. - * @return error number + * \return error number */ QSE_EXPORT qse_pio_errnum_t qse_pio_geterrnum ( const qse_pio_t* pio /**< pio object */ @@ -288,7 +293,7 @@ QSE_EXPORT qse_pio_errnum_t qse_pio_geterrnum ( /** * The qse_pio_getcmgr() function returns the current character manager. - * It returns #QSE_NULL is @a pio is not opened with #QSE_PIO_TEXT. + * It returns #QSE_NULL is \a pio is not opened with #QSE_PIO_TEXT. */ QSE_EXPORT qse_cmgr_t* qse_pio_getcmgr ( qse_pio_t* pio, @@ -296,8 +301,8 @@ QSE_EXPORT qse_cmgr_t* qse_pio_getcmgr ( ); /** - * The qse_pio_setcmgr() function changes the character manager to @a cmgr. - * The character manager is used only if @a pio is opened with #QSE_PIO_TEXT. + * The qse_pio_setcmgr() function changes the character manager to \a cmgr. + * The character manager is used only if \a pio is opened with #QSE_PIO_TEXT. */ QSE_EXPORT void qse_pio_setcmgr ( qse_pio_t* pio, @@ -307,7 +312,7 @@ QSE_EXPORT void qse_pio_setcmgr ( /** * The qse_pio_gethandle() function gets a pipe handle. - * @return pipe handle + * \return pipe handle */ QSE_EXPORT qse_pio_hnd_t qse_pio_gethandle ( const qse_pio_t* pio, /**< pio object */ @@ -316,16 +321,16 @@ QSE_EXPORT qse_pio_hnd_t qse_pio_gethandle ( /** * The qse_pio_getchild() function gets a process handle. - * @return process handle + * \return process handle */ QSE_EXPORT qse_pio_pid_t qse_pio_getchild ( const qse_pio_t* pio /**< pio object */ ); /** - * The qse_pio_read() fucntion reads at most @a size bytes/characters - * and stores them to the buffer pointed to by @a buf. - * @return -1 on failure, 0 on EOF, data length read on success + * The qse_pio_read() fucntion reads at most \a size bytes/characters + * and stores them to the buffer pointed to by \a buf. + * \return -1 on failure, 0 on EOF, data length read on success */ QSE_EXPORT qse_ssize_t qse_pio_read ( qse_pio_t* pio, /**< pio object */ @@ -335,11 +340,14 @@ QSE_EXPORT qse_ssize_t qse_pio_read ( ); /** - * The qse_pio_write() function writes up @a size bytes/characters - * from the buffer pointed to by @a data. If #QSE_PIO_TEXT is used - * and the @a size parameter is (qse_size_t)-1, the function treats - * the @a data parameter as a pointer to a null-terminated string. - * @return -1 on failure, data length written on success + * The qse_pio_write() function writes up \a size bytes/characters + * from the buffer pointed to by \a data. If #QSE_PIO_TEXT is used + * and the \a size parameter is (qse_size_t)-1, the function treats + * the \a data parameter as a pointer to a null-terminated string. + * (qse_size_t)-1 into \a size is not treated specially if #QSE_PIO_TEXT + * is not set. + * + * \return -1 on failure, data length written on success */ QSE_EXPORT qse_ssize_t qse_pio_write ( qse_pio_t* pio, /**< pio object */ @@ -377,12 +385,12 @@ QSE_EXPORT void qse_pio_end ( /** * The qse_pio_wait() function waits for a child process to terminate. * #QSE_PIO_WAIT_NORETRY causes the function to return an error and set the - * @a pio->errnum field to #QSE_PIO_EINTR if the underlying system call has + * \a pio->errnum field to #QSE_PIO_EINTR if the underlying system call has * been interrupted. If #QSE_PIO_WAIT_NOBLOCK is used, the return value of 256 * indicates that the child process has not terminated. Otherwise, 256 is never * returned. * - * @return + * \return * -1 on error, 256 if the child is alive and #QSE_PIO_WAIT_NOBLOCK is used, * a number between 0 and 255 inclusive if the child process ends normally, * 256 + signal number if the child process is terminated by a signal. @@ -396,7 +404,7 @@ QSE_EXPORT int qse_pio_wait ( * You should know the danger of calling this function as the function can * kill a process that is not your child process if it has terminated but * there is a new process with the same process handle. - * @return 0 on success, -1 on failure + * \return 0 on success, -1 on failure */ QSE_EXPORT int qse_pio_kill ( qse_pio_t* pio /**< pio object */ diff --git a/qse/include/qse/config.h.in b/qse/include/qse/config.h.in index 3e7fe701..33e0df0d 100644 --- a/qse/include/qse/config.h.in +++ b/qse/include/qse/config.h.in @@ -137,6 +137,15 @@ */ #undef HAVE_DIRENT_H +/* Define to 1 if you have the `dirfd' function. */ +#undef HAVE_DIRFD + +/* Define to 1 if `dd_fd' is a member of `DIR'. */ +#undef HAVE_DIR_DD_FD + +/* Define to 1 if `d_fd' is a member of `DIR'. */ +#undef HAVE_DIR_D_FD + /* Define if you have the GNU dld library. */ #undef HAVE_DLD diff --git a/qse/include/qse/http/httpd.h b/qse/include/qse/http/httpd.h index 1b3a1906..305e8cf3 100644 --- a/qse/include/qse/http/httpd.h +++ b/qse/include/qse/http/httpd.h @@ -683,7 +683,9 @@ struct qse_httpd_urs_t QSE_HTTPD_MATE_HDR; /* == PUBLIC == */ - qse_httpd_hnd_t handle[5]; + + /* urs.open() can set the followings */ + qse_httpd_hnd_t handle[5]; int handle_count; unsigned long handle_mask; void* ctx; diff --git a/qse/lib/cmn/mux.c b/qse/lib/cmn/mux.c index 2830de89..d4554e60 100644 --- a/qse/lib/cmn/mux.c +++ b/qse/lib/cmn/mux.c @@ -46,6 +46,7 @@ #elif defined(__DOS__) # include + #else # include # include @@ -53,7 +54,11 @@ # if defined(HAVE_SYS_TIME_H) # include # endif -# if defined(HAVE_SYS_EVENT_H) && defined(HAVE_KQUEUE) && defined(HAVE_KEVENT) + +# if defined(QSE_MUX_USE_SELECT) + /* you can set QSE_MUX_USE_SELECT to force using select() */ +# define USE_SELECT +# elif defined(HAVE_SYS_EVENT_H) && defined(HAVE_KQUEUE) && defined(HAVE_KEVENT) # include # define USE_KQUEUE # elif defined(HAVE_SYS_EPOLL_H) @@ -61,9 +66,11 @@ # if defined(HAVE_EPOLL_CREATE) # define USE_EPOLL # endif +/* # elif defined(HAVE_POLL_H) - /* TODO */ + TODO: IMPLEMENT THIS # define USE_POLL +*/ # else # define USE_SELECT # endif diff --git a/qse/lib/cmn/nwad.c b/qse/lib/cmn/nwad.c index 145ac1ba..e565f5d4 100644 --- a/qse/lib/cmn/nwad.c +++ b/qse/lib/cmn/nwad.c @@ -604,7 +604,7 @@ qse_size_t qse_nwadtowcs ( if (flags & QSE_NWADTOMBS_ADDR) { if (xlen + 1 >= len) goto done; - buf[xlen++] = QSE_WT(']'); + buf[xlen++] = QSE_WT(']'); if (xlen + 1 >= len) goto done; buf[xlen++] = QSE_WT(':'); diff --git a/qse/lib/cmn/pio.c b/qse/lib/cmn/pio.c index 0df45700..d0579e83 100644 --- a/qse/lib/cmn/pio.c +++ b/qse/lib/cmn/pio.c @@ -376,7 +376,13 @@ static int close_unneeded_fds_using_proc (int* excepts, qse_size_t count) qse_mchar_t buf[64]; qse_mbsxfmt (buf, QSE_COUNTOF(buf), QSE_MT("/proc/%d/fd"), QSE_GETPID()); d = QSE_OPENDIR (buf); + #if !defined(_SCO_DS) + /* on SCO OpenServer, a range of file descriptors starting from 0 are + * listed under /dev/fd regardless of opening state. And some high + * numbered descriptors are not listed all. not reliable */ + if (!d) d = QSE_OPENDIR (QSE_MT("/dev/fd")); /* Darwin, FreeBSD */ + #endif } if (d) diff --git a/qse/lib/cmn/sck.c b/qse/lib/cmn/sck.c index f35eb723..c958fccc 100644 --- a/qse/lib/cmn/sck.c +++ b/qse/lib/cmn/sck.c @@ -51,6 +51,14 @@ #endif +#if !defined(SHUT_RD) +# define SHUT_RD 0 +#endif + +#if !defined(SHUT_WR) +# define SHUT_WR 1 +#endif + #if !defined(SHUT_RDWR) # define SHUT_RDWR 2 #endif diff --git a/qse/lib/cmn/syscall.h b/qse/lib/cmn/syscall.h index 049351e7..77cc61fe 100644 --- a/qse/lib/cmn/syscall.h +++ b/qse/lib/cmn/syscall.h @@ -372,7 +372,15 @@ #define QSE_OPENDIR(name) opendir(name) #define QSE_CLOSEDIR(dir) closedir(dir) #define QSE_REWINDDIR(dir) rewinddir(dir) -#define QSE_DIRFD(dir) dirfd(dir) +#if defined(HAVE_DIRFD) +# define QSE_DIRFD(dir) dirfd(dir) +#elif defined(HAVE_DIR_DD_FD) +# define QSE_DIRFD(dir) ((dir)->dd_fd) +#elif defined(HAVE_DIR_D_FD) +# define QSE_DIRFD(dir) ((dir)->d_fd) +#else +# error OUCH!!! NO DIRFD AVAILABLE +#endif #define QSE_DIR DIR #if defined(HAVE_READDIR64) diff --git a/qse/lib/http/httpd-std-dns.h b/qse/lib/http/httpd-std-dns.h index 8185e24d..7f15c867 100644 --- a/qse/lib/http/httpd-std-dns.h +++ b/qse/lib/http/httpd-std-dns.h @@ -184,7 +184,7 @@ struct dns_ans_t * this condition is required for reusing the dns_req_t chunk * when caching an answer without allocating another chunk. */ qse_nwad_t nwad; - qse_int64_t age; + qse_long_t age; qse_uint32_t ttl; dns_ans_t* next; }; @@ -539,7 +539,7 @@ static int dns_recv (qse_httpd_t* httpd, qse_httpd_dns_t* dns, qse_httpd_hnd_t h httpd_xtn_t* httpd_xtn; qse_skad_t fromaddr; - socklen_t fromlen; + qse_sck_len_t fromlen; qse_uint8_t buf[DNS_MAX_MSG_LEN]; qse_ssize_t len; diff --git a/qse/lib/http/httpd-std-urs.h b/qse/lib/http/httpd-std-urs.h index b1017e26..479b2d15 100644 --- a/qse/lib/http/httpd-std-urs.h +++ b/qse/lib/http/httpd-std-urs.h @@ -95,12 +95,13 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs) qse_nwad_t nwad; urs_ctx_t* dc; httpd_xtn_t* httpd_xtn; - int type, proto = IPPROTO_UDP; //IPPROTO_SCTP; + int type, proto = IPPROTO_UDP; /*IPPROTO_SCTP*/ httpd_xtn = qse_httpd_getxtn (httpd); urs->handle[0] = QSE_INVALID_SCKHND; urs->handle[1] = QSE_INVALID_SCKHND; + urs->handle[2] = QSE_INVALID_SCKHND; dc = (urs_ctx_t*) qse_httpd_callocmem (httpd, QSE_SIZEOF(urs_ctx_t)); if (dc == NULL) goto oops; @@ -132,6 +133,7 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs) #if defined(AF_INET6) urs->handle[1] = open_udp_socket (httpd, AF_INET6, type, proto); #endif + /*urs->handle[2] = open_unix_socket (httpd, AF_UNIX, SOCK_DGRAM);*/ if (!qse_isvalidsckhnd(urs->handle[0]) && !qse_isvalidsckhnd(urs->handle[1])) { @@ -160,12 +162,14 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs) /* TODO: error ahndleing */ if (qse_isvalidsckhnd(urs->handle[0])) listen (urs->handle[0], 99); if (qse_isvalidsckhnd(urs->handle[1])) listen (urs->handle[1], 99); + /* handle[2] is a unix socket. no special handling for SCTP */ } #endif - urs->handle_count = 2; + urs->handle_count = 3; if (qse_isvalidsckhnd(urs->handle[0])) urs->handle_mask |= (1 << 0); if (qse_isvalidsckhnd(urs->handle[1])) urs->handle_mask |= (1 << 1); + if (qse_isvalidsckhnd(urs->handle[2])) urs->handle_mask |= (1 << 2); urs->ctx = dc; return 0; @@ -173,6 +177,7 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs) oops: if (qse_isvalidsckhnd(urs->handle[0])) qse_closesckhnd (urs->handle[0]); if (qse_isvalidsckhnd(urs->handle[1])) qse_closesckhnd (urs->handle[1]); + if (qse_isvalidsckhnd(urs->handle[2])) qse_closesckhnd (urs->handle[2]); if (dc) qse_httpd_freemem (httpd, dc); return -1; @@ -210,6 +215,7 @@ static void urs_close (qse_httpd_t* httpd, qse_httpd_urs_t* urs) if (qse_isvalidsckhnd(urs->handle[0])) qse_closesckhnd (urs->handle[0]); if (qse_isvalidsckhnd(urs->handle[1])) qse_closesckhnd (urs->handle[1]); + if (qse_isvalidsckhnd(urs->handle[2])) qse_closesckhnd (urs->handle[2]); qse_httpd_freemem (httpd, urs->ctx); } @@ -220,7 +226,7 @@ static int urs_recv (qse_httpd_t* httpd, qse_httpd_urs_t* urs, qse_httpd_hnd_t h httpd_xtn_t* httpd_xtn; qse_skad_t fromaddr; - socklen_t fromlen; + qse_sck_len_t fromlen; qse_uint16_t xid; qse_ssize_t len, url_len; @@ -358,7 +364,6 @@ static int urs_send (qse_httpd_t* httpd, qse_httpd_urs_t* urs, const qse_mchar_t urs_req_t* req = QSE_NULL; qse_size_t url_len; qse_tmr_event_t tmout_event; - printf ("... URS_SEND.....................\n"); httpd_xtn = qse_httpd_getxtn (httpd); diff --git a/qse/lib/http/httpd-std.c b/qse/lib/http/httpd-std.c index 3fe3752b..5147dc4b 100644 --- a/qse/lib/http/httpd-std.c +++ b/qse/lib/http/httpd-std.c @@ -2154,8 +2154,8 @@ if (qse_htre_getcontentlen(req) > 0) else { if (mth == QSE_HTTP_POST && - !(req->flags & QSE_HTRE_ATTR_LENGTH) && - !(req->flags & QSE_HTRE_ATTR_CHUNKED)) + !(req->flags & QSE_HTRE_ATTR_LENGTH) && + !(req->flags & QSE_HTRE_ATTR_CHUNKED)) { /* POST without Content-Length nor not chunked */ req->flags &= ~QSE_HTRE_ATTR_KEEPALIVE; @@ -2181,8 +2181,8 @@ if (qse_htre_getcontentlen(req) > 0) { task = QSE_NULL; - if ((rsrc.flags & QSE_HTTPD_RSRC_100_CONTINUE) && - (task = qse_httpd_entaskcontinue (httpd, client, task, req)) == QSE_NULL) + if ((rsrc.flags & QSE_HTTPD_RSRC_100_CONTINUE) && + (task = qse_httpd_entaskcontinue (httpd, client, task, req)) == QSE_NULL) { /* inject '100 continue' first if it is needed */ goto oops;