diff --git a/lib/http-cgi.c b/lib/http-cgi.c index e0f08df..af5c03e 100644 --- a/lib/http-cgi.c +++ b/lib/http-cgi.c @@ -973,7 +973,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r csck->on_disconnect = cgi_client_on_disconnect; HIO_ASSERT (hio, cli->rsrc == HIO_NULL); - HIO_SVC_HTTS_RSRC_ATTACH (cgi, cli->rsrc); /* cli->rsrc = cgi */ + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)cgi, cli->rsrc); /* cli->rsrc = cgi */ if (access(mi.cmd, X_OK) == -1) { @@ -984,7 +984,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r cgi->peer = hio_dev_pro_make(hio, HIO_SIZEOF(*peer_xtn), &mi); if (HIO_UNLIKELY(!cgi->peer)) goto oops; peer_xtn = hio_dev_pro_getxtn(cgi->peer); - HIO_SVC_HTTS_RSRC_ATTACH (cgi, peer_xtn->cgi); /* peer->cgi in pro = cgi */ + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)cgi, peer_xtn->cgi); /* peer->cgi in pro = cgi */ cgi->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*peer_xtn)); if (HIO_UNLIKELY(!cgi->peer_htrd)) goto oops; @@ -992,7 +992,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r hio_htrd_setrecbs (cgi->peer_htrd, &peer_htrd_recbs); peer_xtn = hio_htrd_getxtn(cgi->peer_htrd); - HIO_SVC_HTTS_RSRC_ATTACH (cgi, peer_xtn->cgi); /* peer->cgi in htrd = cgi */ + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)cgi, peer_xtn->cgi); /* peer->cgi in htrd = cgi */ #if !defined(CGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) if (cgi->req_content_length_unlimited) diff --git a/lib/http-fcgi.c b/lib/http-fcgi.c index 5a691c6..9088fe6 100644 --- a/lib/http-fcgi.c +++ b/lib/http-fcgi.c @@ -532,13 +532,13 @@ int hio_svc_htts_dofcgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* csck->on_disconnect = fcgi_client_on_disconnect; HIO_ASSERT (hio, cli->rsrc == HIO_NULL); - HIO_SVC_HTTS_RSRC_ATTACH (fcgi, cli->rsrc); /* cli->rsrc = fcgi */ + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)fcgi, cli->rsrc); /* cli->rsrc = fcgi */ #if 0 // TODO fcgi->peer = hio_dev_pro_make(hio, HIO_SIZEOF(*peer_xtn), &mi); if (HIO_UNLIKELY(!fcgi->peer)) goto oops; peer_xtn = hio_dev_pro_getxtn(fcgi->peer); - HIO_SVC_HTTS_RSRC_ATTACH (fcgi, peer_xtn->fcgi); /* peer->fcgi = fcgi */ + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)fcgi, peer_xtn->fcgi); /* peer->fcgi = fcgi */ #else fcgi->peer = hio_svc_fcgic_tie(htts->fcgic, fcgis_addr /* TODO: add a read callback */); if (HIO_UNLIKELY(!fcgi->peer)) goto oops; @@ -553,7 +553,7 @@ int hio_svc_htts_dofcgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* hio_htrd_setrecbs (fcgi->peer_htrd, &peer_htrd_recbs); peer = hio_htrd_getxtn(fcgi->peer_htrd); - HIO_SVC_HTTS_RSRC_ATTACH (fcgi, peer->fcgi); /* peer->fcgi = fcgi */ + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)fcgi, peer->fcgi); /* peer->fcgi = fcgi */ #endif #if !defined(FCGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) diff --git a/lib/http-file.c b/lib/http-file.c index 3ad0b37..fe10f2a 100644 --- a/lib/http-file.c +++ b/lib/http-file.c @@ -810,7 +810,7 @@ int hio_svc_htts_dofile (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* file->peer = -1; HIO_ASSERT (hio, cli->rsrc == HIO_NULL); /* you must not call this function while cli->rsrc is not HIO_NULL */ - HIO_SVC_HTTS_RSRC_ATTACH (file, cli->rsrc); /* cli->rsrc = file with ref-count up */ + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)file, cli->rsrc); /* cli->rsrc = file with ref-count up */ #if !defined(FILE_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) diff --git a/lib/http-svr.c b/lib/http-svr.c index e52fec1..5c33fc6 100644 --- a/lib/http-svr.c +++ b/lib/http-svr.c @@ -703,7 +703,7 @@ hio_bch_t* hio_svc_htts_dupmergepaths (hio_svc_htts_t* htts, const hio_bch_t* ba ta[idx++] = base; if (path[0] != '\0') { - ta[idx++] = "/"; + if (base[hio_count_bcstr(base) - 1] != '/') ta[idx++] = "/"; ta[idx++] = path; } ta[idx++] = HIO_NULL; diff --git a/lib/http-thr.c b/lib/http-thr.c index 598cfee..dee709f 100644 --- a/lib/http-thr.c +++ b/lib/http-thr.c @@ -878,7 +878,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r csck->on_disconnect = thr_client_on_disconnect; HIO_ASSERT (hio, cli->rsrc == HIO_NULL); - HIO_SVC_HTTS_RSRC_ATTACH (thr_state, cli->rsrc); + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)thr_state, cli->rsrc); thr_state->peer = hio_dev_thr_make(hio, HIO_SIZEOF(*thr_peer), &mi); if (HIO_UNLIKELY(!thr_state->peer)) @@ -890,7 +890,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r tfs = HIO_NULL; /* mark that tfs is delegated to the thread */ thr_peer = hio_dev_thr_getxtn(thr_state->peer); - HIO_SVC_HTTS_RSRC_ATTACH (thr_state, thr_peer->state); + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)thr_state, thr_peer->state); thr_state->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*thr_peer)); if (HIO_UNLIKELY(!thr_state->peer_htrd)) goto oops; @@ -898,7 +898,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r hio_htrd_setrecbs (thr_state->peer_htrd, &thr_peer_htrd_recbs); thr_peer = hio_htrd_getxtn(thr_state->peer_htrd); - HIO_SVC_HTTS_RSRC_ATTACH (thr_state, thr_peer->state); + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)thr_state, thr_peer->state); #if !defined(THR_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) if (thr_state->req_content_length_unlimited) diff --git a/lib/http-txt.c b/lib/http-txt.c index c316830..47a893a 100644 --- a/lib/http-txt.c +++ b/lib/http-txt.c @@ -345,7 +345,7 @@ int hio_svc_htts_dotxt (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r csck->on_disconnect = txt_client_on_disconnect; HIO_ASSERT (hio, cli->rsrc == HIO_NULL); - HIO_SVC_HTTS_RSRC_ATTACH (txt, cli->rsrc); + HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)txt, cli->rsrc); if (req->flags & HIO_HTRE_ATTR_EXPECT100) { diff --git a/lib/rad-msg.c b/lib/rad-msg.c index 37a0e0d..73c5947 100644 --- a/lib/rad-msg.c +++ b/lib/rad-msg.c @@ -378,7 +378,8 @@ static int delete_attribute (hio_rad_hdr_t* auth, hio_rad_attr_hdr_t* attr) tmp_len = ((hio_uint8_t*)attr - (hio_uint8_t*)auth) + attr->length; if (tmp_len > auth_len) return -1; /* can this happen? */ - HIO_MEMCPY (attr, (hio_uint8_t*)attr + attr->length, auth_len - tmp_len); + /* HIO_MEMCPY() on some platforms doesn't handle overlappig memory regions */ + HIO_MEMMOVE (attr, (hio_uint8_t*)attr + attr->length, auth_len - tmp_len); auth_len -= attr->length; auth->length = hio_hton16(auth_len);