mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: WURFL: wurfl_get() and wurfl_get_all() now return an empty string if device detection fails
This commit is contained in:
parent
e9fedf560a
commit
9896981675
24
src/wurfl.c
24
src/wurfl.c
@ -433,14 +433,14 @@ static int ha_wurfl_get_all(const struct arg *args, struct sample *smp, const ch
|
|||||||
wh.wsmp = smp;
|
wh.wsmp = smp;
|
||||||
dHandle = wurfl_lookup(global_wurfl.handle, &ha_wurfl_retrieve_header, &wh);
|
dHandle = wurfl_lookup(global_wurfl.handle, &ha_wurfl_retrieve_header, &wh);
|
||||||
|
|
||||||
if (!dHandle) {
|
|
||||||
ha_wurfl_log("WURFL: unable to retrieve device from request %s\n", wurfl_get_error_message(global_wurfl.handle));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
temp = get_trash_chunk();
|
temp = get_trash_chunk();
|
||||||
chunk_reset(temp);
|
chunk_reset(temp);
|
||||||
|
|
||||||
|
if (!dHandle) {
|
||||||
|
ha_wurfl_log("WURFL: unable to retrieve device from request %s\n", wurfl_get_error_message(global_wurfl.handle));
|
||||||
|
goto wurfl_get_all_completed;
|
||||||
|
}
|
||||||
|
|
||||||
list_for_each_entry(wi, &global_wurfl.information_list, list) {
|
list_for_each_entry(wi, &global_wurfl.information_list, list) {
|
||||||
|
|
||||||
switch(wi->data.type) {
|
switch(wi->data.type) {
|
||||||
@ -481,6 +481,8 @@ static int ha_wurfl_get_all(const struct arg *args, struct sample *smp, const ch
|
|||||||
chunk_appendf(temp, "%c", global_wurfl.information_list_separator);
|
chunk_appendf(temp, "%c", global_wurfl.information_list_separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wurfl_get_all_completed:
|
||||||
|
|
||||||
wurfl_device_destroy(dHandle);
|
wurfl_device_destroy(dHandle);
|
||||||
smp->data.u.str.area = temp->area;
|
smp->data.u.str.area = temp->area;
|
||||||
smp->data.u.str.data = temp->data;
|
smp->data.u.str.data = temp->data;
|
||||||
@ -507,14 +509,14 @@ static int ha_wurfl_get(const struct arg *args, struct sample *smp, const char *
|
|||||||
wh.wsmp = smp;
|
wh.wsmp = smp;
|
||||||
dHandle = wurfl_lookup(global_wurfl.handle, &ha_wurfl_retrieve_header, &wh);
|
dHandle = wurfl_lookup(global_wurfl.handle, &ha_wurfl_retrieve_header, &wh);
|
||||||
|
|
||||||
if (!dHandle) {
|
|
||||||
ha_wurfl_log("WURFL: unable to retrieve device from request %s\n", wurfl_get_error_message(global_wurfl.handle));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
temp = get_trash_chunk();
|
temp = get_trash_chunk();
|
||||||
chunk_reset(temp);
|
chunk_reset(temp);
|
||||||
|
|
||||||
|
if (!dHandle) {
|
||||||
|
ha_wurfl_log("WURFL: unable to retrieve device from request %s\n", wurfl_get_error_message(global_wurfl.handle));
|
||||||
|
goto wurfl_get_completed;
|
||||||
|
}
|
||||||
|
|
||||||
while (args[i].data.str.area) {
|
while (args[i].data.str.area) {
|
||||||
node = ebst_lookup(&global_wurfl.btree, args[i].data.str.area);
|
node = ebst_lookup(&global_wurfl.btree, args[i].data.str.area);
|
||||||
|
|
||||||
@ -567,6 +569,8 @@ static int ha_wurfl_get(const struct arg *args, struct sample *smp, const char *
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wurfl_get_completed:
|
||||||
|
|
||||||
wurfl_device_destroy(dHandle);
|
wurfl_device_destroy(dHandle);
|
||||||
smp->data.u.str.area = temp->area;
|
smp->data.u.str.area = temp->area;
|
||||||
smp->data.u.str.data = temp->data;
|
smp->data.u.str.data = temp->data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user