registry.save_registry_every_entries = config_get_number("registry", "registry save db every new entries", 1000000);
registry.persons_expiration = config_get_number("registry", "registry expire idle persons days", 365) * 86400;
registry.registry_domain = config_get("registry", "registry domain", "");
- registry.registry_to_announce = config_get("registry", "registry to announce", "https://registry.my-netdata.io");
+ registry.registry_to_announce = config_get("registry", "registry to announce", "//registry.my-netdata.io");
registry.hostname = config_get("registry", "registry hostname", config_get("global", "hostname", hostname));
registry.max_url_length = config_get_number("registry", "max URL length", 1024);
static inline char *http_header_parse(struct web_client *w, char *s) {
- static uint32_t connection_hash = 0, accept_encoding_hash = 0, origin_hash = 0;
-
- if(unlikely(connection_hash == 0)) {
- connection_hash = simple_hash("Connection");
- accept_encoding_hash = simple_hash("Accept-Encoding");
- origin_hash = simple_hash("Origin");
- }
-
char *e = s;
// find the :
// get the name
*e = '\0';
- uint32_t hash = simple_hash(s);
// find the value
char *v, *ve;
// terminate the value
*ve = '\0';
- if(hash == origin_hash && !strcmp(s, "Origin")) {
+ // fprintf(stderr, "HEADER: '%s' = '%s'\n", s, v);
+
+ if(!strcasecmp(s, "Origin")) {
strncpy(w->origin, v, ORIGIN_MAX);
}
- else if(hash == connection_hash && !strcmp(s, "Connection")) {
+ else if(!strcasecmp(s, "Connection")) {
if(!strcasestr(v, "keep-alive"))
w->keepalive = 1;
}
#ifdef NETDATA_WITH_ZLIB
- else if(hash == accept_encoding_hash && !strcmp(s, "Accept-Encoding")) {
- if(web_enable_gzip && !strcasestr(v, "gzip"))
+ else if(!strcasecmp(s, "Accept-Encoding")) {
+ if(web_enable_gzip && strcasestr(v, "gzip")) {
w->enable_gzip = 1;
+ }
}
#endif /* NETDATA_WITH_ZLIB */
if(w->mode == WEB_CLIENT_MODE_OPTIONS) {
buffer_strcat(w->response.header_output,
"Access-Control-Allow-Methods: GET, OPTIONS\r\n"
- "Access-Control-Allow-Headers: Accept, X-Requested-With, Content-Type, Cookie\r\n"
+ "Access-Control-Allow-Headers: accept, x-requested-with, origin, content-type, cookie\r\n"
"Access-Control-Max-Age: 1209600\r\n" // 86400 * 14
);
}