diff --git a/mio/lib/htre.c b/mio/lib/htre.c index 3f6dc02..8b352dc 100644 --- a/mio/lib/htre.c +++ b/mio/lib/htre.c @@ -89,8 +89,9 @@ void mio_htre_fini (mio_htre_t* re) { mio_freemem (re->mio, re->orgqpath.buf); re->orgqpath.buf = MIO_NULL; - re->orgqpath.len = 0; re->orgqpath.capa = 0; + re->orgqpath.ptr = MIO_NULL; + re->orgqpath.len = 0; } } @@ -109,13 +110,8 @@ void mio_htre_clear (mio_htre_t* re) re->state = 0; re->flags = 0; - if (re->orgqpath.buf) - { - mio_freemem (re->mio, re->orgqpath.buf); - re->orgqpath.buf = MIO_NULL; - re->orgqpath.len = 0; - re->orgqpath.capa = 0; - } + re->orgqpath.ptr = MIO_NULL; + re->orgqpath.len = 0; MIO_MEMSET (&re->version, 0, MIO_SIZEOF(re->version)); MIO_MEMSET (&re->attr, 0, MIO_SIZEOF(re->attr)); @@ -293,8 +289,9 @@ int mio_htre_perdecqpath (mio_htre_t* re) if (re->orgqpath.buf) { mio_freemem (re->mio, re->orgqpath.buf); - re->orgqpath.len = 0; re->orgqpath.capa = 0; + re->orgqpath.ptr = MIO_NULL; + re->orgqpath.len = 0; } re->orgqpath.buf = mio_dupbchars(re->mio, re->u.q.path.ptr, re->u.q.path.len); diff --git a/mio/lib/http-svr.c b/mio/lib/http-svr.c index f6a9a06..dd14fae 100644 --- a/mio/lib/http-svr.c +++ b/mio/lib/http-svr.c @@ -119,6 +119,8 @@ if (mio_htre_getcontentlen(req) > 0) } else { +//mio_svc_htts_sendstatus (htts, csck, 500, mth, mio_htre_getversion(req), (req->flags & MIO_HTRE_ATTR_KEEPALIVE), MIO_NULL); +//return 0; #if 0 if (mth == MIO_HTTP_POST && !(req->flags & MIO_HTRE_ATTR_LENGTH) && @@ -584,6 +586,11 @@ void mio_svc_htts_sendstatus (mio_svc_htts_t* htts, mio_dev_sck_t* csck, int sta { mio_dev_sck_halt (csck); } + + if (!keepalive) + { + mio_dev_sck_write(csck, MIO_NULL, 0, MIO_NULL, MIO_NULL); /* arrange to close the writing end */ + } }