Made behavior of mg_get_cookie(..) on errors the same as mg_get_var(..). Separated the two cases a.) problems with destination buffer and b.) cookie header or cookie parameter not existing.

This commit is contained in:
nullable.type committed 2012-12-16 22:20:21 +01:00
1 parent ca9212c3ca
commit 8faf6f7b72
2 files changed
+31 -26

No files matched your search

+3 -3
View File
@@ -308,9 +308,9 @@ int mg_get_var(const char *data, size_t data_len,
//
// Return:
// On success, value length.
// On error, -1 (either "Cookie:" header is not present at all, or the
// requested parameter is not found, or destination buffer is too small
// to hold the value).
// On error:
// -1 (either "Cookie:" header is not present at all or the requested parameter is not found).
// -2 (destination buffer is NULL, zero length or too small to hold the value).
int mg_get_cookie(const struct mg_connection *,
const char *cookie_name, char *buf, size_t buf_len);