2019-07-19 Fred Gleason <fredg@paravelsystems.com>

* Added an 'HttpUserAgent=' directive to the '[Identity]' section
	of rd.conf(5).
This commit is contained in:
Fred Gleason 2019-07-19 13:56:13 -04:00
parent 504754f726
commit ae23c18c62
5 changed files with 21 additions and 14 deletions

View File

@ -18871,3 +18871,6 @@
* Fixed a bug that broke the 'Switch Take' ['ST'],
'Switch Add' ['SA'] and 'Switch Remove' ['SR'] RMLs when
using the 'Local Audio Adapter' driver.
2019-07-19 Fred Gleason <fredg@paravelsystems.com>
* Added an 'HttpUserAgent=' directive to the '[Identity]' section
of rd.conf(5).

View File

@ -41,6 +41,11 @@ Password=letmein
; This entry is what will appear in RDSelect's list for this configuration.
Label=Default (Local)
; This entry will override the default value of the HTTP_USER_AGENT header
; used when making HTTP requests. Rarely needed!
;HttpUserAgent=Mozilla/5.0 rivendell/3.0
[mySQL]
; The connection parameters for the MySQL server.
Hostname=localhost

View File

@ -1696,7 +1696,7 @@ bool RDCart::removeCutAudio(RDStation *station,RDUser *user,unsigned cart_num,
curl_easy_setopt(curl,CURLOPT_URL,url);
curl_easy_setopt(curl,CURLOPT_HTTPPOST,first);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)RDConfig::userAgent(""));
(const char *)rda->config()->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,CartWriteCallback);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml);

View File

@ -86,9 +86,15 @@ void RDConfig::setModuleName(const QString &modname)
}
QString RDConfig::userAgent() const
QString RDConfig::userAgent(const QString &modname) const
{
return RDConfig::userAgent(conf_module_name);
if(!conf_http_user_agent.isEmpty()) {
return conf_http_user_agent;
}
if(modname.isEmpty()) {
return QString("Mozilla/5.0")+" rivendell/"+VERSION;
}
return QString("Mozilla/5.0 rivendell/")+VERSION+" ("+modname+")";
}
@ -482,6 +488,7 @@ bool RDConfig::load()
conf_rn_rml_group=
profile->stringValue("Identity","RnRmlGroup",RD_DEFAULT_RN_RML_GROUP);
conf_label=profile->stringValue("Identity","Label",RD_DEFAULT_LABEL);
conf_http_user_agent=profile->stringValue("Identity","HttpUserAgent");
conf_audio_store_mount_source=
profile->stringValue("AudioStore","MountSource");
@ -644,6 +651,7 @@ void RDConfig::clear()
conf_alsa_channels_per_pcm=-1;
conf_station_name="";
conf_password="";
conf_http_user_agent="";
conf_audio_owner="";
conf_audio_group="";
conf_pypad_owner="";
@ -682,15 +690,6 @@ void RDConfig::clear()
}
QString RDConfig::userAgent(const QString &modname)
{
if(modname.isEmpty()) {
return QString("Mozilla/5.0")+" rivendell/"+VERSION;
}
return QString("Mozilla/5.0 rivendell/")+VERSION+" ("+modname+")";
}
QString RDConfig::createTablePostfix(const QString &engine)
{
return QString(" engine ")+engine+" ";

View File

@ -54,7 +54,7 @@ class RDConfig
void setFilename(QString filename);
QString moduleName() const;
void setModuleName(const QString &modname);
QString userAgent() const;
QString userAgent(const QString &modname="") const;
QString mysqlHostname() const;
QString mysqlUsername() const;
QString mysqlDbname() const;
@ -114,7 +114,6 @@ class RDConfig
QString destination(unsigned n);
bool load();
void clear();
static QString userAgent(const QString &modname);
static QString createTablePostfix(const QString &engine);
static QString rdselectExitCodeText(RDSelectExitCode code);
@ -159,6 +158,7 @@ class RDConfig
QString conf_audio_store_mount_options;
QString conf_audio_store_xport_hostname;
QString conf_audio_store_cae_hostname;
QString conf_http_user_agent;
bool conf_disable_maint_checks;
bool conf_lock_rdairplay_memory;
std::vector<QString> conf_jack_ports[2];