From d4eed93ac9061dc4c15b6114910965202afda4b8 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 22 Jun 2022 13:14:35 +0000 Subject: [PATCH] minor fix in hio_dev_sck_sendfileok() --- hio/bin/t01.c | 4 ++-- hio/bin/t06.c | 4 ++-- hio/lib/http-cgi.c | 10 ++++++++++ hio/lib/sck.c | 10 ++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/hio/bin/t01.c b/hio/bin/t01.c index d0b803a..086f068 100644 --- a/hio/bin/t01.c +++ b/hio/bin/t01.c @@ -974,9 +974,9 @@ if (hio_htre_getcontentlen(req) > 0) else if (hio_comp_bcstr_limited(qpath, "/txt/", 5, 1) == 0) x = hio_svc_htts_dotxt(htts, csck, req, 200, "text/plain", qpath); else if (hio_comp_bcstr_limited(qpath, "/cgi/", 5, 1) == 0) - x = hio_svc_htts_docgi(htts, csck, req, "", hio_htre_getqpath(req)); + x = hio_svc_htts_docgi(htts, csck, req, "", qpath + 4); else - x = hio_svc_htts_dofile(htts, csck, req, "", hio_htre_getqpath(req), "text/plain"); + x = hio_svc_htts_dofile(htts, csck, req, "", qpath, "text/plain"); if (x <= -1) goto oops; } #if 0 diff --git a/hio/bin/t06.c b/hio/bin/t06.c index 52bdf80..a243001 100644 --- a/hio/bin/t06.c +++ b/hio/bin/t06.c @@ -203,9 +203,9 @@ if (hio_htre_getcontentlen(req) > 0) else if (hio_comp_bcstr_limited(qpath, "/txt/", 5, 1) == 0) x = hio_svc_htts_dotxt(htts, csck, req, 200, "text/plain", qpath); else if (hio_comp_bcstr_limited(qpath, "/cgi/", 5, 1) == 0) - x = hio_svc_htts_docgi(htts, csck, req, "", hio_htre_getqpath(req)); + x = hio_svc_htts_docgi(htts, csck, req, "", qpath + 4); else - x = hio_svc_htts_dofile(htts, csck, req, "", hio_htre_getqpath(req), "text/plain"); + x = hio_svc_htts_dofile(htts, csck, req, "", qpath, "text/plain"); if (x <= -1) goto oops; } #if 0 diff --git a/hio/lib/http-cgi.c b/hio/lib/http-cgi.c index d28037f..550500f 100644 --- a/hio/lib/http-cgi.c +++ b/hio/lib/http-cgi.c @@ -32,6 +32,10 @@ #include #include /* setenv, clearenv */ +#if defined(HAVE_CRT_EXTERNS_H) +# include /* _NSGetEnviron */ +#endif + #define CGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH enum cgi_res_mode_t @@ -830,6 +834,12 @@ static int cgi_peer_on_fork (hio_dev_pro_t* pro, void* fork_ctx) lang = hio_dupbcstr(hio, getenv("LANG"), HIO_NULL); #if defined(HAVE_CLEARENV) clearenv (); +#elif defined(HAVE_CRT_EXTERNS_H) + { + char** environ = *_NSGetEnviron(); + if (environ) environ[0] = '\0'; + } + #else { extern char** environ; diff --git a/hio/lib/sck.c b/hio/lib/sck.c index 7ec9b8c..33174b8 100644 --- a/hio/lib/sck.c +++ b/hio/lib/sck.c @@ -2591,9 +2591,19 @@ int hio_dev_sck_shutdown (hio_dev_sck_t* dev, int how) int hio_dev_sck_sendfileok (hio_dev_sck_t* dev) { #if defined(USE_SSL) + #if defined(HAVE_SENDFILE) + /* unable to use sendfile over ssl */ return !(dev->ssl); + #else + /* no send file implementation */ + return 0; + #endif #else + #if defined(HAVE_SENDFILE) return 1; + #else + return 0; + #endif #endif }