added server.tag; small fixes and cleanups
This commit is contained in:
commit
fd4031beea
|
@ -702,11 +702,11 @@
|
|||
|
||||
# scanner
|
||||
value_scanner := ( value (any - value - ws) >keyvalue_end );
|
||||
block_scanner := ( (noise | comment | statement)* '}' >block_end );
|
||||
block_scanner := ( (noise | statement)* '}' >block_end );
|
||||
list_scanner := ( noise* (value %list_push (noise* ',' noise* value %list_push)*)? noise* ')' >list_end );
|
||||
hash_scanner := ( noise* (hash_elem %hash_push (noise* ',' noise* hash_elem %hash_push)*)? noise* ']' >hash_end );
|
||||
|
||||
main := (noise | comment | statement)* '\00';
|
||||
main := (noise | statement)* '\00';
|
||||
}%%
|
||||
|
||||
%% write data;
|
||||
|
|
|
@ -74,7 +74,7 @@ gboolean log_write_(server *srv, connection *con, log_level_t log_level, const g
|
|||
}
|
||||
}
|
||||
|
||||
g_string_assign(log->lastmsg, log_line->str);
|
||||
log->lastmsg = g_string_assign(log->lastmsg, log_line->str);
|
||||
|
||||
g_string_append_len(log_line, CONST_STR_LEN("\r\n"));
|
||||
|
||||
|
|
|
@ -362,6 +362,8 @@ static const plugin_option options[] = {
|
|||
{ "log.level", OPTION_STRING, core_option_log_level_parse, core_option_log_level_free },
|
||||
|
||||
{ "static-file.exclude", OPTION_LIST, NULL, NULL },
|
||||
|
||||
{ "server.tag", OPTION_STRING, NULL, NULL },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@ enum core_options_t {
|
|||
CORE_OPTION_LOG_TARGET = 1,
|
||||
CORE_OPTION_LOG_LEVEL = 2,
|
||||
|
||||
CORE_OPTION_STATIC_FILE_EXCLUDE = 3
|
||||
CORE_OPTION_STATIC_FILE_EXCLUDE = 3,
|
||||
|
||||
CORE_OPTION_SERVER_TAG = 4
|
||||
};
|
||||
|
||||
/* the core plugin always has base index 0, as it is the first plugin loaded */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "base.h"
|
||||
#include "utils.h"
|
||||
#include "plugin_core.h"
|
||||
|
||||
void response_init(response *resp) {
|
||||
resp->headers = http_headers_new();
|
||||
|
@ -112,10 +113,18 @@ void response_send_headers(server *srv, connection *con) {
|
|||
}
|
||||
|
||||
if (!have_server) {
|
||||
/* TODO: use option for this */
|
||||
g_string_append_len(head, CONST_STR_LEN("Server: "));
|
||||
g_string_append_len(head, CONST_STR_LEN("lighttpd-2.0~sandbox"));
|
||||
g_string_append_len(head, CONST_STR_LEN("\r\n"));
|
||||
GString *tag = CORE_OPTION(CORE_OPTION_SERVER_TAG);
|
||||
|
||||
if (!tag || tag->len) {
|
||||
g_string_append_len(head, CONST_STR_LEN("Server: "));
|
||||
|
||||
if (tag)
|
||||
g_string_append_len(head, GSTR_LEN(tag));
|
||||
else
|
||||
g_string_append_len(head, CONST_STR_LEN("lighttpd-2.0~sandbox"));
|
||||
|
||||
g_string_append_len(head, CONST_STR_LEN("\r\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue