Skip to content
This repository
Browse code

More compact default user-agent.

Resembles a Web browser. Included Mac OS specific variant.
Is less likely to be blocked as an undesired agent/content scraper/spambot.
(Sorry, including a URL is like admitting that the agent is up to no good.)
  • Loading branch information...
commit 02d90d25f717e6578b8c0ad21af47cd79fdb3709 1 parent 9e2e356
Daniel Aleksandersen Aeyoun authored

Showing 1 changed file with 9 additions and 1 deletion. Show diff stats Hide diff stats

  1. +9 1 src/utils.cpp
10 src/utils.cpp
@@ -540,7 +540,15 @@ std::string utils::get_useragent(configcontainer * cfgcont) {
540 540 if (ua_pref.length() == 0) {
541 541 struct utsname buf;
542 542 uname(&buf);
543   - return utils::strprintf("%s/%s (%s %s; %s; %s) %s", PROGRAM_NAME, PROGRAM_VERSION, buf.sysname, buf.release, buf.machine, PROGRAM_URL, curl_version());
  543 + if (strcmp(buf.sysname, "Darwin") == 0) {
  544 + /* Assume it is a Mac from the last decade or at least Mac-like */
  545 + const char* PROCESSOR = "";
  546 + if (strcmp(buf.machine, "x86_64") == 0 || strcmp(buf.machine, "i386") == 0) {
  547 + PROCESSOR = "Intel ";
  548 + }
  549 + return utils::strprintf("%s/%s (Macintosh; %sMac OS X)", PROGRAM_NAME, PROGRAM_VERSION, PROCESSOR);
  550 + }
  551 + return utils::strprintf("%s/%s (%s %s)", PROGRAM_NAME, PROGRAM_VERSION, buf.sysname, buf.machine);
544 552 }
545 553 return ua_pref;
546 554 }

0 comments on commit 02d90d2

Please sign in to comment.
Something went wrong with that request. Please try again.