Guest User

Untitled

a guest
Jul 15th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. Index: src/modules/config_gnome.c
  2. ===================================================================
  3. --- src/modules/config_gnome.c (revision 448)
  4. +++ src/modules/config_gnome.c (working copy)
  5. @@ -46,7 +46,10 @@
  6. "/system/proxy/secure_host", "/system/proxy/secure_port",
  7. "/system/proxy/ftp_host", "/system/proxy/ftp_port",
  8. "/system/proxy/socks_host", "/system/proxy/socks_port",
  9. - "/system/http_proxy/ignore_hosts", NULL
  10. + "/system/http_proxy/ignore_hosts",
  11. + "/system/http_proxy/use_authentication",
  12. + "/system/http_proxy/authentication_user",
  13. + "/system/http_proxy/authentication_password", NULL
  14. };
  15.  
  16. static FILE *
  17. @@ -166,6 +169,9 @@
  18. char *type = px_strdup("http");
  19. char *host = NULL;
  20. char *port = NULL;
  21. + char *username = NULL;
  22. + char *password = NULL;
  23. +
  24. uint16_t p = 0;
  25.  
  26. // Get the per-scheme proxy settings
  27. @@ -188,6 +194,10 @@
  28.  
  29. host = px_strdup(px_strdict_get(self->data, "/system/http_proxy/host"));
  30. port = px_strdup(px_strdict_get(self->data, "/system/http_proxy/port"));
  31. + if (!strcmp(px_strdict_get(self->data, "/system/http_proxy/use_authentication"), "true")) {
  32. + username = px_strdup(px_strdict_get(self->data, "/system/http_proxy/authentication_user"));
  33. + password = px_strdup(px_strdict_get(self->data, "/system/http_proxy/authentication_password"));
  34. + }
  35. if (!port || sscanf(port, "%hu", &p) != 1) p = 0;
  36. }
  37.  
  38. @@ -206,11 +216,13 @@
  39.  
  40. // If host and port were found, build config url
  41. if (host && strcmp(host, "") && p)
  42. - curl = px_strcat(type, "://", host, ":", port, NULL);
  43. + curl = px_strcat(type, "://", username && password ? px_strcat(username, ":", password, "@", NULL) : "", host, ":", port, NULL);
  44.  
  45. px_free(type);
  46. px_free(host);
  47. px_free(port);
  48. + px_free(username);
  49. + px_free(password);
  50. }
  51.  
  52. // Start a refresh in the background
Add Comment
Please, Sign In to add comment