comparison src/http/ngx_http.c @ 5856:1b8459a53e4b

Avoided to add duplicate hash key in ngx_http_types_slot().
author Gu Feng <flygoast@126.com>
date Wed, 17 Sep 2014 22:52:02 +0800
parents b490bfbf8cfa
children 42d9beeb22db
comparison
equal deleted inserted replaced
5855:a0a14319968b 5856:1b8459a53e4b
2003 for (n = 0; n < (*types)->nelts; n++) { 2003 for (n = 0; n < (*types)->nelts; n++) {
2004 2004
2005 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { 2005 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) {
2006 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, 2006 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
2007 "duplicate MIME type \"%V\"", &value[i]); 2007 "duplicate MIME type \"%V\"", &value[i]);
2008 continue; 2008 goto next;
2009 } 2009 }
2010 } 2010 }
2011 2011
2012 type = ngx_array_push(*types); 2012 type = ngx_array_push(*types);
2013 if (type == NULL) { 2013 if (type == NULL) {
2015 } 2015 }
2016 2016
2017 type->key = value[i]; 2017 type->key = value[i];
2018 type->key_hash = hash; 2018 type->key_hash = hash;
2019 type->value = (void *) 4; 2019 type->value = (void *) 4;
2020
2021 next:
2022
2023 continue;
2020 } 2024 }
2021 2025
2022 return NGX_CONF_OK; 2026 return NGX_CONF_OK;
2023 } 2027 }
2024 2028