2021-11-08 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in the rdxport.cgi service that caused XML output
	to be encoded with the incorrect character set.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-11-08 16:46:45 -05:00
parent 0152cd357b
commit 5226c7c926
13 changed files with 45 additions and 39 deletions

View File

@ -22590,3 +22590,6 @@
2021-11-08 Fred Gleason <fredg@paravelsystems.com>
* Added a 'python36-requests' dependency to the
'python36-rivwebpyapi' RPM package.
2021-11-08 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in the rdxport.cgi service that caused XML output
to be encoded with the incorrect character set.

View File

@ -2,7 +2,7 @@
//
// Rivendell web service portal -- AudioInfo service
//
// (C) Copyright 2011,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2011-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -67,7 +67,7 @@ void Xport::AudioInfo()
//
// Send Data
//
printf("Content-type: application/xml\n\n");
printf("Content-type: application/xml; charset=utf-8\n\n");
switch(wave->getFormatTag()) {
case WAVE_FORMAT_PCM:

View File

@ -42,7 +42,7 @@ void Xport::AudioStore()
if(statvfs(rda->config()->audioRoot().toUtf8(),&stat)<0) {
XmlExit("Internal Error",400,"audiostore.cpp",LINE_NUMBER);
}
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<audioStore>\n");

View File

@ -102,7 +102,7 @@ void Xport::AddCart()
delete cart;
XmlExit("Unable to create cart ["+err_msg+"]",500,"carts.cpp",LINE_NUMBER);
}
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<cartAdd>\n");
@ -170,7 +170,7 @@ void Xport::ListCarts()
//
// Process Request
//
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<cartList>\n");
@ -208,7 +208,7 @@ void Xport::ListCart()
//
// Process Request
//
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<cartList>\n");
@ -395,7 +395,7 @@ void Xport::EditCart()
cart->updateLength();
}
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<cartList>\n");
@ -486,7 +486,7 @@ void Xport::AddCut()
delete cart;
XmlExit("No new cuts available",500,"carts.cpp",LINE_NUMBER);
}
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<cutAdd>\n");
@ -531,7 +531,7 @@ void Xport::ListCuts()
sql=RDCart::xmlSql(true)+
QString::asprintf(" where `CART`.`NUMBER`=%u",cart_number);
q=new RDSqlQuery(sql);
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<cutList>\n");
@ -576,7 +576,7 @@ void Xport::ListCut()
delete cut;
XmlExit("No such cut",404,"carts.cpp",LINE_NUMBER);
}
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<cutList>\n");
@ -856,7 +856,7 @@ void Xport::EditCut()
delete cart;
}
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<cutList>\n");

View File

@ -2,7 +2,7 @@
//
// Rivendell web service portal -- Group services
//
// (C) Copyright 2010-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2010-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -52,7 +52,7 @@ void Xport::ListGroups()
//
// Process Request
//
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<groupList>\n");
@ -98,7 +98,7 @@ void Xport::ListGroup()
//
// Process Request
//
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
group=new RDGroup(q->value(0).toString());

View File

@ -260,7 +260,7 @@ void Xport::Import()
if(!title.isEmpty()) {
cart->setTitle(title);
}
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: %d\n",resp_code);
printf("\n");
printf("<RDWebResult>\r\n");

View File

@ -186,7 +186,7 @@ void Xport::ListLogs()
//
// Process Request
//
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<logList>\n");
@ -230,10 +230,10 @@ void Xport::ListLog()
//
// Process Request
//
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("%s\n",(const char *)log_model->xml().toUtf8());
printf("%s\n",log_model->xml().toUtf8().constData());
Exit(0);
}
@ -594,7 +594,7 @@ void Xport::LockLog()
XmlExit("No such log",404,"logs.cpp",LINE_NUMBER);
}
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
switch(op_type) {
case Xport::LockLogCreate:
@ -603,24 +603,27 @@ void Xport::LockLog()
addr=xport_remote_address;
lock_guid=RDLogLock::makeGuid(xport_remote_hostname);
if(RDLogLock::tryLock(&username,&stationname,&addr,log_name,lock_guid)) {
printf("%s",(const char *)LogLockXml(true,log_name,lock_guid,"","",addr).toUtf8());
printf("%s",LogLockXml(true,log_name,lock_guid,"","",addr).toUtf8().
constData());
}
else {
printf("%s",(const char *)LogLockXml(false,log_name,"",username,
stationname,addr).toUtf8());
printf("%s",LogLockXml(false,log_name,"",username,
stationname,addr).toUtf8().constData());
}
Exit(0);
break;
case Xport::LockLogUpdate:
RDLogLock::updateLock(log_name,lock_guid);
printf("%s",(const char *)LogLockXml(true,log_name,lock_guid,"","",addr).toUtf8());
printf("%s",LogLockXml(true,log_name,lock_guid,"","",addr).toUtf8().
constData());
Exit(0);
break;
case Xport::LockLogClear:
RDLogLock::clearLock(lock_guid);
printf("%s",(const char *)LogLockXml(true,log_name,lock_guid,"","",addr).toUtf8());
printf("%s",LogLockXml(true,log_name,lock_guid,"","",addr).toUtf8().
constData());
Exit(0);
break;
}

View File

@ -408,12 +408,12 @@ void Xport::TryCreateTicket(const QString &name)
QDateTime expire_datetime;
if(rda->user()->createTicket(&ticket,&expire_datetime,
xport_post->clientAddress(),now)) {
printf("Content-type: application/xml\n\n");
printf("Content-type: application/xml; charset=utf-8\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<ticketInfo>\n");
printf(" %s\n",RDXmlField("ticket",ticket).toUtf8().constData());
printf(" %s\n",
(const char *)RDXmlField("expires",expire_datetime).toUtf8());
RDXmlField("expires",expire_datetime).toUtf8().constData());
printf("</ticketInfo>\n");
exit(0);
}

View File

@ -40,13 +40,13 @@ void Xport::ListSchedCodes()
//
// Process Request
//
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<schedCodeList>\n");
while(q->next()) {
schedcode=new RDSchedCode(q->value(0).toString());
printf("%s",(const char *)schedcode->xml().toUtf8());
printf("%s",schedcode->xml().toUtf8().constData());
delete schedcode;
}
printf("</schedCodeList>\n");
@ -170,13 +170,13 @@ void Xport::ListCartSchedCodes()
//
// Process Request
//
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<schedCodeList>\n");
for(int i=0;i<codes.size();i++) {
schedcode=new RDSchedCode(codes[i]);
printf("%s",(const char *)schedcode->xml().toUtf8());
printf("%s",schedcode->xml().toUtf8().constData());
delete schedcode;
}
printf("</schedCodeList>\n");

View File

@ -72,13 +72,13 @@ void Xport::ListServices()
//
// Process Request
//
printf("Content-type: application/xml\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<serviceList>\n");
while(q->next()) {
svc=new RDSvc(q->value(0).toString(),rda->station(),rda->config());
printf("%s",(const char *)svc->xml().toUtf8());
printf("%s",svc->xml().toUtf8().constData());
delete svc;
}
printf("</serviceList>\n");

View File

@ -2,7 +2,7 @@
//
// Rivendell web service portal -- ListSystemSettings service
//
// (C) Copyright 2011,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2011-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -38,8 +38,8 @@ void Xport::ListSystemSettings()
//
// Send Data
//
printf("Content-type: application/xml\n\n");
printf("Content-type: application/xml; charset=utf-8\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("%s\n",(const char *)sys->xml().toUtf8());
printf("%s\n",sys->xml().toUtf8().constData());
Exit(0);
}

View File

@ -1,4 +1,4 @@
// savestring.cpp
// tests.cpp
//
// Rivendell web service portal -- save string test
//
@ -51,7 +51,7 @@ void Xport::SaveString()
// Process Request
//
rda->syslog(LOG_INFO,"SAVESTRING: |%s|",(const char *)string.toUtf8());
printf("Content-type: application/xml; charset: UTF-8\n");
printf("Content-type: application/xml; charset=utf-8\n");
printf("Status: 200\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("%s\n",(const char *)RDXmlField("string",string).toUtf8());

View File

@ -2,7 +2,7 @@
//
// Rivendell web service portal -- TrimAudio service
//
// (C) Copyright 2010-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2010-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -76,7 +76,7 @@ void Xport::TrimAudio()
//
// Send Data
//
printf("Content-type: application/xml\n\n");
printf("Content-type: application/xml; charset=utf-8\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<trimPoint>\n");
printf(" <cartNumber>%u</cartNumber>\n",cartnum);