如何在 mongoose Web 服务器上使用 C++ 设置 cookie?我在这里找到了一些东西https://www.cesanta.com/developer/mongoose#_mg_http_parse_header但我不确定我是否正在寻找。
问问题
846 次
1 回答
0
您应该向Set-Cookie
客户端发送一个 HTTP 标头。mg_send_head()
mongoose 有多种方法可以做到这一点,例如使用https://www.cesanta.com/developer/mongoose#_mg_send_head:
mg_send_head(conn, 200, content_len, "Set-Cookie: token=1234; Expires=Wed, 09 Jun 2021 10:18:14 GMT");
Set-Cookie 标头格式在https://www.rfc-editor.org/rfc/rfc6265中进行了描述。维基百科也有一篇很好的文章,https://en.wikipedia.org/wiki/HTTP_cookie
于 2016-01-21T17:19:16.087 回答