mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Add SetCookie method to redbean Lua (#265)
This commit is contained in:
parent
969174e155
commit
31dd714081
5 changed files with 178 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "net/http/http.h"
|
||||
|
||||
static unsigned ParseMonth(const char *p) {
|
||||
|
@ -36,10 +37,12 @@ static unsigned ParseMonth(const char *p) {
|
|||
* Sun, 04 Oct 2020 19:50:10 GMT
|
||||
*
|
||||
* @return seconds from unix epoch
|
||||
* @param n if -1 implies strlen
|
||||
* @see FormatHttpDateTime()
|
||||
*/
|
||||
int64_t ParseHttpDateTime(const char *p, size_t n) {
|
||||
unsigned weekday, year, month, day, hour, minute, second, yday, leap;
|
||||
if (n == -1) n = p ? strlen(p) : 0;
|
||||
if (n != 29) return 0;
|
||||
day = (p[5] - '0') * 10 + (p[6] - '0') - 1;
|
||||
month = ParseMonth(p + 8);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue