From b66003a3cae3adad2183bbc010a3a28664323024 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 28 Nov 2013 09:34:44 +0100 Subject: move query string handling below referer handling --- cqrlogo.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cqrlogo.c b/cqrlogo.c index 4f4692e..3c0e579 100644 --- a/cqrlogo.c +++ b/cqrlogo.c @@ -247,18 +247,6 @@ int main(int argc, char **argv) { uri_server_name = malloc(10 + strlen(server_name)); sprintf(uri_server_name, "http%s://%s/", https ? "s" : "", server_name); - /* get query string and read settings */ - if ((query_string = getenv("QUERY_STRING")) != NULL) { - /* do we have a special scale? */ - get_value(query_string, "scale", &scale, QRCODE_SCALE, 1, QRCODE_MAX_SCALE); - - /* width of the border? */ - get_value(query_string, "border", &border, QRCODE_BORDER, 0, QRCODE_MAX_BORDER); - - /* error correction level? */ - get_value(query_string, "level", &level, QRCODE_LEVEL, 0, QR_ECLEVEL_H); - } - /* get http referer */ if ((http_referer = getenv("HTTP_REFERER")) != NULL) { uri = http_referer; @@ -285,6 +273,18 @@ int main(int argc, char **argv) { uri = uri_server_name; } + /* get query string and read settings */ + if ((query_string = getenv("QUERY_STRING")) != NULL) { + /* do we have a special scale? */ + get_value(query_string, "scale", &scale, QRCODE_SCALE, 1, QRCODE_MAX_SCALE); + + /* width of the border? */ + get_value(query_string, "border", &border, QRCODE_BORDER, 0, QRCODE_MAX_BORDER); + + /* error correction level? */ + get_value(query_string, "level", &level, QRCODE_LEVEL, 0, QR_ECLEVEL_H); + } + /* encode the QR-Code */ if ((bitmap = encode_qrcode(uri, scale, border, level)) == NULL) { /* uri too long? retry with uri from server name */ -- cgit v1.2.3-70-g09d2