Opened 6 years ago

Closed 5 years ago

Last modified 2 years ago

#12320 closed Bug Report - General (Fixed)

Services API GetSetting is Case Sensitive

Reported by: drew@… Owned by: Bill Meek
Priority: minor Milestone: 0.28
Component: MythTV - Services API - Backend Version: 0.27.4
Severity: medium Keywords: services api
Cc: Ticket locked: no


GetSetting? performs a SQL select against the given hostname, but also against any hostname not defined for a key. Then it loops through to find the corresponding value to use, comparing the provided hostname with the DB hostname. In the case of MySQL and other default case-insensitive databases, this causes problems.

In this case where the function is provided the hostname 'HTPC' and key of 'BackendServerIP'. The DB has hostname 'htpc' instead. The select statement returns the correct row, however the if statement does not select this. Instead it returns no value at all because it didn't 'find' it in the loop.

A simple patch:

(sHostName.toLower() == query.value(1).toString().toLower())

Change History (5)

comment:1 Changed 5 years ago by Bill Meek

Owner: set to Bill Meek
Status: newassigned

comment:2 Changed 5 years ago by Bill Meek

Status: assignedinfoneeded

Please add the output of these 3 commands:

mysql> SELECT DISTINCT hostname FROM settings;

$ hostname

$ curl yourBackendIPorHostname:6544/Myth/GetHostName

comment:3 Changed 5 years ago by drew@…

mysql> SELECT DISTINCT hostname FROM settings;
| hostname        |
| Backend         |
| NULL            |
| HTPC1           |
| BedroomPi       |
| DeskPi          |
| LivingRoom      |
| localhost       |
| LoftRPI2        |
| xbian           |
9 rows in set (0.03 sec)

$ hostname

$ curl
<?xml version="1.0" encoding="UTF-8"?><String>Backend</String>

This doesn't show the "htpc" lower-case version because I have since removed that client and its associated settings.

comment:4 Changed 5 years ago by Bill Meek

Milestone: unknown0.28
Resolution: Fixed
Status: infoneededclosed

Fixed in 0.28 (which entered Beta today.) The following example now works:


Myth/GetHostName returns: backend0 for this example. Both the HostName and Key values are case agnostic (as are the parameter names themselves.)

comment:5 Changed 2 years ago by Bill Meek

Owner: changed from Bill Meek to Bill Meek
Note: See TracTickets for help on using tickets.