Fix handling of uri-specific parameters

We need to (re)apply uri-specific parameters for each new uri even if
the parameter has already been set to get the correct value.

Thanks to Julien STEINHAUSER <julien.steinhauser@orange.fr> for the
report!
This commit is contained in:
Quentin Rameau 2017-05-18 12:33:28 +02:00
parent a1328457cf
commit 2223417c91

26
surf.c
View file

@ -643,7 +643,7 @@ cookiepolicy_set(const WebKitCookieAcceptPolicy p)
void void
seturiparameters(Client *c, const char *uri) seturiparameters(Client *c, const char *uri)
{ {
Parameter *newconfig = NULL; Parameter *config, *newconfig = NULL;
int i; int i;
for (i = 0; i < LENGTH(uriparams); ++i) { for (i = 0; i < LENGTH(uriparams); ++i) {
@ -656,16 +656,26 @@ seturiparameters(Client *c, const char *uri)
if (!newconfig) if (!newconfig)
newconfig = defconfig; newconfig = defconfig;
if (newconfig == curconfig)
return;
for (i = 0; i < ParameterLast; ++i) { for (i = 0; i < ParameterLast; ++i) {
if (defconfig[i].force) switch(i) {
case Certificate:
case CookiePolicies:
case Style:
config = defconfig[i].force ? defconfig :
newconfig[i].force ? newconfig :
defconfig;
break;
default:
if (newconfig == curconfig || defconfig[i].force)
continue; continue;
if (newconfig[i].force) config = newconfig[i].force ? newconfig :
setparameter(c, 0, i, &newconfig[i].val); curconfig[i].force ? defconfig :
else if (curconfig[i].force) NULL;
setparameter(c, 0, i, &defconfig[i].val); }
if (config)
setparameter(c, 0, i, &config[i].val);
} }
curconfig = newconfig; curconfig = newconfig;