diff --git a/ChangeLog b/ChangeLog index 9fce278b..01a40f4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22590,3 +22590,6 @@ 2021-11-08 Fred Gleason * Added a 'python36-requests' dependency to the 'python36-rivwebpyapi' RPM package. +2021-11-08 Fred Gleason + * Fixed a bug in the rdxport.cgi service that caused XML output + to be encoded with the incorrect character set. diff --git a/web/rdxport/audioinfo.cpp b/web/rdxport/audioinfo.cpp index 175a6156..0227dac3 100644 --- a/web/rdxport/audioinfo.cpp +++ b/web/rdxport/audioinfo.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- AudioInfo service // -// (C) Copyright 2011,2016 Fred Gleason +// (C) Copyright 2011-2021 Fred Gleason // // 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: diff --git a/web/rdxport/audiostore.cpp b/web/rdxport/audiostore.cpp index 0c892cf7..75f28c05 100644 --- a/web/rdxport/audiostore.cpp +++ b/web/rdxport/audiostore.cpp @@ -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("\n"); printf("\n"); diff --git a/web/rdxport/carts.cpp b/web/rdxport/carts.cpp index bff8407a..6cf58a26 100644 --- a/web/rdxport/carts.cpp +++ b/web/rdxport/carts.cpp @@ -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("\n"); printf("\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("\n"); printf("\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("\n"); printf("\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("\n"); printf("\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("\n"); printf("\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("\n"); printf("\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("\n"); printf("\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("\n"); printf("\n"); diff --git a/web/rdxport/groups.cpp b/web/rdxport/groups.cpp index 4b44e058..68f188ed 100644 --- a/web/rdxport/groups.cpp +++ b/web/rdxport/groups.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- Group services // -// (C) Copyright 2010-2018 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // 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("\n"); printf("\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("\n"); group=new RDGroup(q->value(0).toString()); diff --git a/web/rdxport/import.cpp b/web/rdxport/import.cpp index 5fa52e72..a63a6312 100644 --- a/web/rdxport/import.cpp +++ b/web/rdxport/import.cpp @@ -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("\r\n"); diff --git a/web/rdxport/logs.cpp b/web/rdxport/logs.cpp index 5ce1ff50..1bb25507 100644 --- a/web/rdxport/logs.cpp +++ b/web/rdxport/logs.cpp @@ -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("\n"); printf("\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("\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; } diff --git a/web/rdxport/rdxport.cpp b/web/rdxport/rdxport.cpp index d256a508..95b41386 100644 --- a/web/rdxport/rdxport.cpp +++ b/web/rdxport/rdxport.cpp @@ -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("\n"); printf("\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("\n"); exit(0); } diff --git a/web/rdxport/schedcodes.cpp b/web/rdxport/schedcodes.cpp index 30c0d158..af368f63 100644 --- a/web/rdxport/schedcodes.cpp +++ b/web/rdxport/schedcodes.cpp @@ -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("\n"); printf("\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("\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("\n"); printf("\n"); for(int i=0;ixml().toUtf8()); + printf("%s",schedcode->xml().toUtf8().constData()); delete schedcode; } printf("\n"); diff --git a/web/rdxport/services.cpp b/web/rdxport/services.cpp index cdc0baf6..e94eab59 100644 --- a/web/rdxport/services.cpp +++ b/web/rdxport/services.cpp @@ -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("\n"); printf("\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("\n"); diff --git a/web/rdxport/systemsettings.cpp b/web/rdxport/systemsettings.cpp index f38a22dd..0b614b44 100644 --- a/web/rdxport/systemsettings.cpp +++ b/web/rdxport/systemsettings.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- ListSystemSettings service // -// (C) Copyright 2011,2016 Fred Gleason +// (C) Copyright 2011-2021 Fred Gleason // // 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("\n"); - printf("%s\n",(const char *)sys->xml().toUtf8()); + printf("%s\n",sys->xml().toUtf8().constData()); Exit(0); } diff --git a/web/rdxport/tests.cpp b/web/rdxport/tests.cpp index 8b4fb03c..67482c56 100644 --- a/web/rdxport/tests.cpp +++ b/web/rdxport/tests.cpp @@ -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("\n"); printf("%s\n",(const char *)RDXmlField("string",string).toUtf8()); diff --git a/web/rdxport/trimaudio.cpp b/web/rdxport/trimaudio.cpp index b952f695..e0a5f025 100644 --- a/web/rdxport/trimaudio.cpp +++ b/web/rdxport/trimaudio.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- TrimAudio service // -// (C) Copyright 2010-2018 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // 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("\n"); printf("\n"); printf(" %u\n",cartnum);