Opened 11 years ago
Closed 10 years ago
Last modified 8 years ago
#12320 closed Bug Report - General (Fixed)
Services API GetSetting is Case Sensitive
| Reported by: | 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 |
Description
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 by , 10 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:2 by , 10 years ago
| Status: | assigned → infoneeded |
|---|
comment:3 by , 10 years ago
mysql> SELECT DISTINCT hostname FROM settings; +-----------------+ | hostname | +-----------------+ | Backend | | NULL | | HTPC1 | | BedroomPi | | DeskPi | | LivingRoom | | localhost | | LoftRPI2 | | xbian | +-----------------+ 9 rows in set (0.03 sec) $ hostname Backend $ curl 10.0.0.254:6544/Myth/GetHostName <?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 by , 10 years ago
| Milestone: | unknown → 0.28 |
|---|---|
| Resolution: | → Fixed |
| Status: | infoneeded → closed |
Fixed in 0.28 (which entered Beta today.) The following example now works:
backend0:6544/Myth/GetSetting?hostname=BACKEND0&KEY=backendserverport
Myth/GetHostName returns: backend0 for this example. Both the HostName and Key values are case agnostic (as are the parameter names themselves.)
comment:5 by , 8 years ago
| Owner: | changed from to |
|---|

Please add the output of these 3 commands: