File: cookie.h

package info (click to toggle)
wget2 2.2.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 22,248 kB
  • sloc: ansic: 121,144; sh: 11,559; makefile: 878; xml: 182; sed: 16
file content (66 lines) | stat: -rw-r--r-- 1,787 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright (c) 2019-2024 Free Software Foundation, Inc.
 *
 * This file is part of libwget.
 *
 * Libwget is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Libwget is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Libwget.  If not, see <https://www.gnu.org/licenses/>.
 *
 *
 * Header file for cookie code
 */

#ifndef LIBWGET_COOKIE_H
#define LIBWGET_COOKIE_H

#include <stdbool.h>
#include <stdint.h>
#include <wget.h>

struct wget_cookie_st {
	const char *
		name;
	const char *
		value;
	const char *
		domain;
	const char *
		path;
	int64_t
		expires; // time of expiration (format YYYYMMDDHHMMSS)
	int64_t
		maxage; // like expires, but precedes it if set
	int64_t
		last_access;
	int64_t
		creation;
	unsigned int
		sort_age; // need for sorting on Cookie: header construction
	bool
		domain_dot : 1, // for compatibility with Netscape cookie format
		normalized : 1,
		persistent : 1,
		host_only : 1,
		secure_only : 1, // cookie should be used over secure connections only (TLS/HTTPS)
		http_only : 1; // just use the cookie via HTTP/HTTPS protocol
};

WGET_GCC_NONNULL_ALL
bool cookie_domain_match(const char *domain, const char *host);

WGET_GCC_NONNULL((1))
bool cookie_path_match(const char *cookie_path, const char *request_path);

void cookie_free(void *cookie);

#endif /* LIBWGET_COOKIE_H */