[hackers] [surf] Fix handling of uri-specific parameters || Quentin Rameau

From: <git_AT_suckless.org>
Date: Sat, 3 Jun 2017 10:39:13 +0200 (CEST)

commit 2223417c91569f8314205d8f34c3cdf4d96d6e1a
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Thu May 18 12:33:28 2017 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Mon May 22 12:38:49 2017 +0200

    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_AT_orange.fr> for the
    report!

diff --git a/surf.c b/surf.c
index 51c1813..7e1bdcb 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -643,7 +643,7 @@ cookiepolicy_set(const WebKitCookieAcceptPolicy p)
 void
 seturiparameters(Client *c, const char *uri)
 {
- Parameter *newconfig = NULL;
+ Parameter *config, *newconfig = NULL;
         int i;
 
         for (i = 0; i < LENGTH(uriparams); ++i) {
_AT_@ -656,16 +656,26 @@ seturiparameters(Client *c, const char *uri)
 
         if (!newconfig)
                 newconfig = defconfig;
- if (newconfig == curconfig)
- return;
 
         for (i = 0; i < ParameterLast; ++i) {
- if (defconfig[i].force)
- continue;
- if (newconfig[i].force)
- setparameter(c, 0, i, &newconfig[i].val);
- else if (curconfig[i].force)
- setparameter(c, 0, i, &defconfig[i].val);
+ 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;
+ config = newconfig[i].force ? newconfig :
+ curconfig[i].force ? defconfig :
+ NULL;
+ }
+
+ if (config)
+ setparameter(c, 0, i, &config[i].val);
         }
 
         curconfig = newconfig;
Received on Sat Jun 03 2017 - 10:39:13 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 03 2017 - 10:48:31 CEST