mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Server sets userlang cookie as global and permanent
Without specifying the "Path" attribute of the cookie in the "Set-Cookie" header we end up with multiple instances of the cookie for different URLs. We want a single "global" cookie for kiwix-serve. Besides we want it to be "permanent" rather than a session cookie, hence the large (1-year-long) TTL value for the "Max-Age" attribute.
This commit is contained in:
committed by
Matthieu Gautier
parent
fcb97c3c06
commit
e35e7585e0
@ -1007,7 +1007,7 @@ TEST_F(ServerTest, UserLanguageControl)
|
||||
/*url*/ "/ROOT/content/zimfile/invalid-article",
|
||||
/*Accept-Language:*/ "",
|
||||
/*Request Cookie:*/ NO_COOKIE,
|
||||
/*Response Set-Cookie:*/ "userlang=en",
|
||||
/*Response Set-Cookie:*/ "userlang=en;Path=/ROOT;Max-Age=31536000",
|
||||
/* expected <h1> */ "Not Found"
|
||||
},
|
||||
{
|
||||
@ -1015,7 +1015,7 @@ TEST_F(ServerTest, UserLanguageControl)
|
||||
/*url*/ "/ROOT/content/zimfile/invalid-article?userlang=en",
|
||||
/*Accept-Language:*/ "",
|
||||
/*Request Cookie:*/ NO_COOKIE,
|
||||
/*Response Set-Cookie:*/ "userlang=en",
|
||||
/*Response Set-Cookie:*/ "userlang=en;Path=/ROOT;Max-Age=31536000",
|
||||
/* expected <h1> */ "Not Found"
|
||||
},
|
||||
{
|
||||
@ -1023,7 +1023,7 @@ TEST_F(ServerTest, UserLanguageControl)
|
||||
/*url*/ "/ROOT/content/zimfile/invalid-article?userlang=test",
|
||||
/*Accept-Language:*/ "",
|
||||
/*Request Cookie:*/ NO_COOKIE,
|
||||
/*Response Set-Cookie:*/ "userlang=test",
|
||||
/*Response Set-Cookie:*/ "userlang=test;Path=/ROOT;Max-Age=31536000",
|
||||
/* expected <h1> */ "[I18N TESTING] Content not found, but at least the server is alive"
|
||||
},
|
||||
{
|
||||
@ -1031,7 +1031,7 @@ TEST_F(ServerTest, UserLanguageControl)
|
||||
/*url*/ "/ROOT/content/zimfile/invalid-article",
|
||||
/*Accept-Language:*/ "*",
|
||||
/*Request Cookie:*/ NO_COOKIE,
|
||||
/*Response Set-Cookie:*/ "userlang=en",
|
||||
/*Response Set-Cookie:*/ "userlang=en;Path=/ROOT;Max-Age=31536000",
|
||||
/* expected <h1> */ "Not Found"
|
||||
},
|
||||
{
|
||||
@ -1039,7 +1039,7 @@ TEST_F(ServerTest, UserLanguageControl)
|
||||
/*url*/ "/ROOT/content/zimfile/invalid-article",
|
||||
/*Accept-Language:*/ "test",
|
||||
/*Request Cookie:*/ NO_COOKIE,
|
||||
/*Response Set-Cookie:*/ "userlang=test",
|
||||
/*Response Set-Cookie:*/ "userlang=test;Path=/ROOT;Max-Age=31536000",
|
||||
/* expected <h1> */ "[I18N TESTING] Content not found, but at least the server is alive"
|
||||
},
|
||||
{
|
||||
@ -1087,7 +1087,7 @@ TEST_F(ServerTest, UserLanguageControl)
|
||||
/*url*/ "/ROOT/content/zimfile/invalid-article?userlang=en",
|
||||
/*Accept-Language:*/ "test",
|
||||
/*Request Cookie:*/ NO_COOKIE,
|
||||
/*Response Set-Cookie:*/ "userlang=en",
|
||||
/*Response Set-Cookie:*/ "userlang=en;Path=/ROOT;Max-Age=31536000",
|
||||
/* expected <h1> */ "Not Found"
|
||||
},
|
||||
{
|
||||
@ -1095,7 +1095,7 @@ TEST_F(ServerTest, UserLanguageControl)
|
||||
/*url*/ "/ROOT/content/zimfile/invalid-article?userlang=en",
|
||||
/*Accept-Language:*/ "",
|
||||
/*Request Cookie:*/ "userlang=test",
|
||||
/*Response Set-Cookie:*/ "userlang=en",
|
||||
/*Response Set-Cookie:*/ "userlang=en;Path=/ROOT;Max-Age=31536000",
|
||||
/* expected <h1> */ "Not Found"
|
||||
},
|
||||
{
|
||||
@ -1113,7 +1113,7 @@ TEST_F(ServerTest, UserLanguageControl)
|
||||
/*url*/ "/ROOT/content/zimfile/invalid-article",
|
||||
/*Accept-Language:*/ "test;q=0.9, en;q=0.2",
|
||||
/*Request Cookie:*/ NO_COOKIE,
|
||||
/*Response Set-Cookie:*/ "userlang=test",
|
||||
/*Response Set-Cookie:*/ "userlang=test;Path=/ROOT;Max-Age=31536000",
|
||||
/* expected <h1> */ "[I18N TESTING] Content not found, but at least the server is alive"
|
||||
},
|
||||
{
|
||||
@ -1123,7 +1123,7 @@ TEST_F(ServerTest, UserLanguageControl)
|
||||
/*url*/ "/ROOT/content/zimfile/invalid-article",
|
||||
/*Accept-Language:*/ "test;q=0.2, en;q=0.9",
|
||||
/*Request Cookie:*/ NO_COOKIE,
|
||||
/*Response Set-Cookie:*/ "userlang=en",
|
||||
/*Response Set-Cookie:*/ "userlang=en;Path=/ROOT;Max-Age=31536000",
|
||||
/* expected <h1> */ "Not Found"
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user