Skip to content

Commit d117c46

Browse files
committed
Forgot to save the new cookie pointer...
1 parent 434b87e commit d117c46

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ libcups v3.0.0 (YYYY-MM-DD)
66

77
- Added `cupsOAuthGetJWKS` API.
88
- Added `httpGetCookieValue` and `httpGetSecurity` APIs.
9-
- Updated `httpSetCookie` API to support multiple "Set-Cookie:" header values.
9+
- Updated the `httpSetCookie` API to support multiple "Set-Cookie:" header
10+
values.
1011
- Updated `ippfind` to use `cupsGetClock` API.
1112
- Fixed return values of `ippDateToTime` when the timezone isn't GMT.
1213
- Fixed a potential timing issue with `cupsEnumDests`.

cups/http.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,8 @@ httpClearCookie(http_t *http) // I - HTTP connection
225225
if (!http)
226226
return;
227227

228-
if (http->cookie)
229-
{
230-
free(http->cookie);
231-
http->cookie = NULL;
232-
}
228+
free(http->cookie);
229+
http->cookie = NULL;
233230
}
234231

235232

@@ -2237,7 +2234,8 @@ httpSetCookie(http_t *http, // I - Connection
22372234
if ((temp = realloc(http->cookie, ctotal)) == NULL)
22382235
return;
22392236

2240-
temp[clen] = '\n';
2237+
http->cookie = temp;
2238+
temp[clen] = '\n';
22412239
cupsCopyString(temp + clen + 1, cookie, ctotal - clen - 1);
22422240
}
22432241
else
@@ -3092,7 +3090,7 @@ httpWriteResponse(http_t *http, // I - HTTP connection
30923090
return (false);
30933091
}
30943092
}
3095-
else if (httpPrintf(http, "Set-Cookie: %s; path=/; httponly;%s\r\n", http->cookie, http->tls ? " secure;" : "") < 1)
3093+
else if (httpPrintf(http, "Set-Cookie: %s; path=/; httponly;%s\r\n", start, http->tls ? " secure;" : "") < 1)
30963094
{
30973095
http->status = HTTP_STATUS_ERROR;
30983096
if (ptr)

0 commit comments

Comments
 (0)