45#define RESPONSE_TIMEOUT 30
97 0, 0, { (
DWORD_PTR)(__FILE__
": cookie_cs") }
110 subdomain_ptr = *
ptr ==
'.' ?
ptr+1 :
ptr;
112 current_domain =
NULL;
116 current_domain = iter;
121 if(!current_domain) {
125 current_domain =
heap_alloc(
sizeof(*current_domain));
130 if(!current_domain->
domain) {
137 current_domain->
parent = prev_domain;
145 return current_domain;
147 prev_domain = current_domain;
157 static const WCHAR cookie_prefix[] = {
'C',
'o',
'o',
'k',
'i',
'e',
':'};
169 memcpy(
url, cookie_prefix,
sizeof(cookie_prefix));
206 return cookie_container;
212 cookie_container =
heap_alloc(
sizeof(*cookie_container));
213 if(!cookie_container)
222 cookie_container->
domain = cookie_domain;
228 return cookie_container;
233 return cookie_container;
249 new_cookie = heap_alloc_zero(
sizeof(*new_cookie));
253 new_cookie->
expiry = expiry;
314 char *
str =
NULL, *pbeg, *pend;
320 if(!cookie_container)
346 pend =
strchr(pbeg,
'\n');
353 pend =
strchr(pbeg,
'\n');
359 pbeg =
strchr(pend+1,
'\n');
403 char buf[64], *dyn_buf;
444 if(!dyn_buf || !
WriteFile(cookie_handle, dyn_buf,
strlen(dyn_buf), &bytes_written,
NULL)) {
450 if(!
WriteFile(cookie_handle,
"\n", 1, &bytes_written,
NULL)) {
456 if(!dyn_buf || !
WriteFile(cookie_handle, dyn_buf,
strlen(dyn_buf), &bytes_written,
NULL)) {
462 if(!
WriteFile(cookie_handle,
"\n", 1, &bytes_written,
NULL)) {
468 if(!dyn_buf || !
WriteFile(cookie_handle, dyn_buf,
strlen(dyn_buf), &bytes_written,
NULL)) {
481 if(!dyn_buf || !
WriteFile(cookie_handle, dyn_buf,
strlen(dyn_buf), &bytes_written,
NULL)) {
499 ERR(
"error saving cookie file\n");
545 while(
p >
host.str &&
p[-1] !=
'.')
p--;
546 while(
p !=
host.str) {
548 while(
p >
host.str &&
p[-1] !=
'.')
p--;
549 if(
p ==
host.str)
break;
559 while(
p >
path.str &&
p[-1] !=
'/')
p--;
560 }
while(
p !=
path.str);
581 TRACE(
"Found expired cookie. deleting\n");
594 }
else if(
res->cnt ==
res->size) {
598 res->cookies = new_cookies;
606 res->string_len += 2;
607 res->cookies[
res->cnt++] = cookie_iter;
610 if(*cookie_iter->
data)
624 for(
i=0;
i<cookie_set->
cnt;
i++) {
651 static const WCHAR cookieW[] = {
'C',
'o',
'o',
'k',
'i',
'e',
':',
' '};
737 TRACE(
"(%s, %s, %p, %p, %x, %p)\n",
debugstr_w(lpszUrl),
debugstr_w(lpszCookieName), lpCookieData,
lpdwSize,
flags,
reserved);
873 if(!
domain.len || *
domain.str ==
'.' || !full_domain.
len || *full_domain.
str ==
'.') {
897 if (!
domain || !full_domain) {
917 const WCHAR *end_ptr;
925 memset(&expiry,0,
sizeof(expiry));
937 static const WCHAR szDomain[] = {
'd',
'o',
'm',
'a',
'i',
'n',
'='};
938 static const WCHAR szPath[] = {
'p',
'a',
't',
'h',
'='};
939 static const WCHAR szExpires[] = {
'e',
'x',
'p',
'i',
'r',
'e',
's',
'='};
940 static const WCHAR szSecure[] = {
's',
'e',
'c',
'u',
'r',
'e'};
941 static const WCHAR szHttpOnly[] = {
'h',
't',
't',
'p',
'o',
'n',
'l',
'y'};
942 static const WCHAR szVersion[] = {
'v',
'e',
'r',
's',
'i',
'o',
'n',
'='};
943 static const WCHAR max_ageW[] = {
'm',
'a',
'x',
'-',
'a',
'g',
'e',
'='};
987 TRACE(
"Cookie already expired.\n");
994 FIXME(
"secure not handled\n");
999 WARN(
"HTTP only cookie added without INTERNET_COOKIE_HTTPONLY flag\n");
1011 WARN(
"Max-Age ignored\n");
1012 }
else if(
data.len) {
1032 update_persistent =
TRUE;
1036 WARN(
"An attempt to override httponly cookie\n");
1043 update_persistent =
TRUE;
1089 if (!lpszUrl || !lpCookieData)
1098 if (!lpszCookieName) {
1210 FIXME(
"(%s, %p, %p, 0x%08x) stub\n",
1211 debugstr_a(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
1228 FIXME(
"(%s, %p, %p, 0x%08x) stub\n",
1229 debugstr_w(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
char * strchr(const char *String, int ch)
static char * heap_strdupWtoA(const WCHAR *str)
static WCHAR * heap_strdupAtoW(const char *str)
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
static void * heap_realloc(void *mem, size_t len)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static int list_empty(struct list_entry *head)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
#define ERROR_NOT_ENOUGH_MEMORY
#define ERROR_INSUFFICIENT_BUFFER
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
#define ERROR_NO_MORE_ITEMS
#define WideCharToMultiByte
#define ERROR_INVALID_NAME
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
BOOL WINAPI InternetTimeToSystemTimeW(LPCWSTR string, SYSTEMTIME *time, DWORD reserved)
HANDLE WINAPI RetrieveUrlCacheEntryStreamW(LPCWSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize, BOOL fRandomRead, DWORD dwReserved)
BOOL WINAPI CreateUrlCacheEntryW(LPCWSTR lpszUrlName, DWORD dwExpectedFileSize, LPCWSTR lpszFileExtension, LPWSTR lpszFileName, DWORD dwReserved)
BOOL WINAPI UnlockUrlCacheEntryStream(IN HANDLE hUrlCacheStream, IN DWORD dwReserved)
BOOL WINAPI CommitUrlCacheEntryW(LPCWSTR lpszUrlName, LPCWSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPWSTR lpHeaderInfo, DWORD dwHeaderSize, LPCWSTR lpszFileExtension, LPCWSTR lpszOriginalUrl)
BOOL WINAPI ReadUrlCacheEntryStream(IN HANDLE hUrlCacheStream, IN DWORD dwLocation, IN OUT LPVOID lpBuffer, IN OUT LPDWORD lpdwLen, IN DWORD dwReserved)
BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
_CONST_RETURN wchar_t *__cdecl wmemchr(_In_reads_(_N) const wchar_t *_S, _In_ wchar_t _C, _In_ size_t _N)
static substr_t substr(const WCHAR *str, size_t len)
static substr_t substrz(const WCHAR *str)
static time_t create_time
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
static DWORD LPSTR PDWORD lpdwSize
static const struct access_res create[16]
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
__WINE_SERVER_LIST_INLINE void list_add_before(struct list *elem, struct list *to_add)
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
LIST_ENTRY ProcessLocksList
struct _cookie_domain_t * domain
struct list subdomain_list
struct _cookie_domain_t * parent
struct _cookie_container_t * container
DWORD WINAPI GetLastError(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
#define ERROR_INVALID_OPERATION
static void delete_cookie(struct cookie *cookie)
static struct cookie * find_cookie(struct domain *domain, const WCHAR *path, const WCHAR *name)
static BOOL add_cookie(struct session *session, struct cookie *cookie, WCHAR *domain_name, WCHAR *path)
struct _cookie_t cookie_t
static BOOL load_persistent_cookie(substr_t domain, substr_t path)
static cookie_container_t * get_cookie_container(substr_t domain, substr_t path, BOOL create)
DWORD WINAPI InternetSetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, LPCWSTR lpCookieData, DWORD flags, DWORD_PTR reserved)
static WCHAR * create_cookie_url(substr_t domain, substr_t path, substr_t *ret_path)
static BOOL save_persistent_cookie(cookie_container_t *container)
DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, DWORD flags)
BOOL WINAPI InternetGetCookieA(const char *url, const char *name, char *data, DWORD *size)
BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName, LPCSTR lpCookieData)
BOOL WINAPI InternetSetPerSiteCookieDecisionW(LPCWSTR pchHostName, DWORD dwDecision)
DWORD WINAPI InternetSetCookieExA(LPCSTR lpszURL, LPCSTR lpszCookieName, LPCSTR lpszCookieData, DWORD dwFlags, DWORD_PTR dwReserved)
BOOL WINAPI InternetGetPerSiteCookieDecisionA(LPCSTR pwchHostName, ULONG *pResult)
static void cookie_set_to_string(const cookie_set_t *cookie_set, WCHAR *str)
static struct list domain_list
BOOL WINAPI InternetGetPerSiteCookieDecisionW(LPCWSTR pwchHostName, ULONG *pResult)
BOOL WINAPI InternetGetCookieW(const WCHAR *url, const WCHAR *name, WCHAR *data, DWORD *size)
static CRITICAL_SECTION cookie_cs
struct _cookie_domain_t cookie_domain_t
BOOL WINAPI InternetEnumPerSiteCookieDecisionA(LPSTR pszSiteName, ULONG *pcSiteNameSize, ULONG *pdwDecision, ULONG dwIndex)
struct _cookie_container_t cookie_container_t
static cookie_domain_t * get_cookie_domain(substr_t domain, BOOL create)
static BOOL cookie_parse_url(const WCHAR *url, substr_t *host, substr_t *path)
static CRITICAL_SECTION_DEBUG cookie_cs_debug
BOOL WINAPI InternetClearAllPerSiteCookieDecisions(VOID)
BOOL WINAPI IsDomainLegalCookieDomainW(const WCHAR *domain, const WCHAR *full_domain)
static DWORD get_cookie(substr_t host, substr_t path, DWORD flags, cookie_set_t *res)
BOOL WINAPI InternetSetPerSiteCookieDecisionA(LPCSTR pchHostName, DWORD dwDecision)
BOOL WINAPI InternetSetCookieW(const WCHAR *url, const WCHAR *name, const WCHAR *data)
DWORD get_cookie_header(const WCHAR *host, const WCHAR *path, WCHAR **ret)
static cookie_t * alloc_cookie(substr_t name, substr_t data, FILETIME expiry, FILETIME create_time, DWORD flags)
BOOL WINAPI InternetGetCookieExA(LPCSTR lpszUrl, LPCSTR lpszCookieName, LPSTR lpCookieData, LPDWORD lpdwSize, DWORD flags, void *reserved)
static void free_cookie_domain_list(struct list *list)
static BOOL is_domain_legal_for_cookie(substr_t domain, substr_t full_domain)
BOOL WINAPI InternetGetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, LPWSTR lpCookieData, LPDWORD lpdwSize, DWORD flags, void *reserved)
static BOOL cookie_match_path(cookie_container_t *container, substr_t path)
static void substr_skip(substr_t *str, size_t len)
BOOL WINAPI InternetEnumPerSiteCookieDecisionW(LPWSTR pszSiteName, ULONG *pcSiteNameSize, ULONG *pdwDecision, ULONG dwIndex)
static void replace_cookie(cookie_container_t *container, cookie_t *new_cookie)
#define INTERNET_COOKIE_IS_SESSION
#define INTERNET_COOKIE_HTTPONLY