aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--src/Routes/Search.c16
2 files changed, 14 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index e57c991..af6b741 100644
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,9 @@ GIT_HASH := $(shell git rev-parse --short HEAD)
GIT_DATE := $(shell git log -1 --format='%ad' --date='format:%y.%m.%d')
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
GIT_REMOTE := $(shell git remote get-url origin)
+GIT_TAG := $(shell git describe --tags --exact-match HEAD 2>/dev/null)
-VERSION := $(GIT_DATE)+$(GIT_HASH)_$(GIT_BRANCH)
+VERSION := $(if $(GIT_TAG),$(GIT_TAG),$(GIT_DATE)+$(GIT_HASH)_$(GIT_BRANCH))
CFLAGS := -Wall -Wextra -O2 -Isrc -DVERSION='"$(VERSION)"' -DGIT_REMOTE='"$(GIT_REMOTE)"'
diff --git a/src/Routes/Search.c b/src/Routes/Search.c
index 7fcdac8..0aa146a 100644
--- a/src/Routes/Search.c
+++ b/src/Routes/Search.c
@@ -486,8 +486,8 @@ int results_handler(UrlParams *params) {
const SearchEngine *selected_engine = find_enabled_engine(selected_engine_id);
if (selected_engine &&
- !engine_allowed_for_user(selected_engine, user_engines,
- user_engine_count, has_user_pref)) {
+ !engine_allowed_for_user(selected_engine, user_engines, user_engine_count,
+ has_user_pref)) {
selected_engine = NULL;
}
if (selected_engine) {
@@ -717,8 +717,16 @@ int results_handler(UrlParams *params) {
if (!warning_message)
continue;
- add_warning_to_collection(jobs[i].engine->name, warning_message,
- &warning_matrix);
+ if (jobs[i].http_status >= 400) {
+ char warning_with_status[BUFFER_SIZE_LARGE];
+ snprintf(warning_with_status, sizeof(warning_with_status),
+ "%s (HTTP %ld)", warning_message, jobs[i].http_status);
+ add_warning_to_collection(jobs[i].engine->name, warning_with_status,
+ &warning_matrix);
+ } else {
+ add_warning_to_collection(jobs[i].engine->name, warning_message,
+ &warning_matrix);
+ }
}
if (warning_matrix.count > 0) {