* Most tests work with HTTP/2 support using nghttp2

* except non-ssl http/1->/2 upgrade
* Restconf: ensure HEAD method works everywhere GET does.
This commit is contained in:
Olof hagsand 2021-06-08 20:53:43 +02:00
parent b680e3c5ac
commit 84f5762ab5
59 changed files with 1683 additions and 1107 deletions

View file

@ -186,14 +186,15 @@ restconf_reply_body_add(void *req0,
/*! Send HTTP reply with potential message body
* @param[in] req Fastcgi request handle
* @param[in] code Status code
* @param[in] cb Body as a cbuf if non-NULL
* @param[in] cb Body as a cbuf if non-NULL. Note is consumed
*
* Prerequisites: status code set, headers given, body if wanted set
*/
int
restconf_reply_send(void *req0,
int code,
cbuf *cb)
cbuf *cb,
int head)
{
FCGX_Request *req = (FCGX_Request *)req0;
int retval = -1;
@ -206,9 +207,12 @@ restconf_reply_send(void *req0,
goto done;
FCGX_FPrintF(req->out, "\r\n");
/* Write a body if cbuf is nonzero */
if (cb != NULL && cbuf_len(cb)){
FCGX_FPrintF(req->out, "%s", cbuf_get(cb));
FCGX_FPrintF(req->out, "\r\n");
if (cb != NULL){
if (!head && cbuf_len(cb)){
FCGX_FPrintF(req->out, "%s", cbuf_get(cb));
FCGX_FPrintF(req->out, "\r\n");
}
cbuf_free(cb);
}
FCGX_FFlush(req->out); /* Is this only for notification ? */
retval = 0;