1313
1414typedef struct {
1515 IP2Proxy * handler ;
16- ngx_int_t access_type ;
1716 ngx_array_t * proxies ;
1817 ngx_flag_t proxy_recursive ;
1918} ngx_http_ip2proxy_conf_t ;
@@ -29,7 +28,6 @@ static IP2ProxyRecord *ngx_http_ip2proxy_get_records(ngx_http_request_t *r);
2928static void * ngx_http_ip2proxy_create_conf (ngx_conf_t * cf );
3029static char * ngx_http_ip2proxy_init_conf (ngx_conf_t * cf , void * conf );
3130static char * ngx_http_ip2proxy_database (ngx_conf_t * cf , ngx_command_t * cmd , void * conf );
32- static char * ngx_http_ip2proxy_access_type (ngx_conf_t * cf , ngx_command_t * cmd , void * conf );
3331static char * ngx_http_ip2proxy_proxy (ngx_conf_t * cf , ngx_command_t * cmd , void * conf );
3432static ngx_int_t ngx_http_ip2proxy_cidr_value (ngx_conf_t * cf , ngx_str_t * net , ngx_cidr_t * cidr );
3533static void ngx_http_ip2proxy_cleanup (void * data );
@@ -43,14 +41,6 @@ static ngx_command_t ngx_http_ip2proxy_commands[] = {
4341 0 ,
4442 NULL
4543 },
46- {
47- ngx_string ("ip2proxy_access_type" ),
48- NGX_HTTP_MAIN_CONF |NGX_CONF_TAKE12 ,
49- ngx_http_ip2proxy_access_type ,
50- NGX_HTTP_MAIN_CONF_OFFSET ,
51- 0 ,
52- NULL
53- },
5444 {
5545 ngx_string ("ip2proxy_proxy" ),
5646 NGX_HTTP_MAIN_CONF |NGX_CONF_TAKE1 ,
@@ -353,29 +343,7 @@ ngx_http_ip2proxy_database(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
353343 return NGX_CONF_ERROR ;
354344 }
355345
356- IP2Proxy_open_mem (gcf -> handler , gcf -> access_type );
357-
358- return NGX_CONF_OK ;
359- }
360-
361- static char *
362- ngx_http_ip2proxy_access_type (ngx_conf_t * cf , ngx_command_t * cmd , void * conf )
363- {
364- ngx_http_ip2proxy_conf_t * gcf = conf ;
365- ngx_str_t * value ;
366-
367- value = cf -> args -> elts ;
368-
369- if (ngx_strcasecmp ((u_char * )"file_io" , value [1 ].data ) == 0 ) {
370- gcf -> access_type = IP2PROXY_FILE_IO ;
371- } else if (ngx_strcasecmp ((u_char * )"cache_memory" , value [1 ].data ) == 0 ) {
372- gcf -> access_type = IP2PROXY_CACHE_MEMORY ;
373- } else if (ngx_strcasecmp ((u_char * )"shared_memory" , value [1 ].data ) == 0 ) {
374- gcf -> access_type = IP2PROXY_SHARED_MEMORY ;
375- } else {
376- ngx_conf_log_error (NGX_LOG_EMERG , cf , 0 , "Unkown access type \"%V\"." , & value [1 ]);
377- return NGX_CONF_ERROR ;
378- }
346+ IP2Proxy_open_mem (gcf -> handler , IP2PROXY_CACHE_MEMORY );
379347
380348 return NGX_CONF_OK ;
381349}
@@ -445,11 +413,6 @@ ngx_http_ip2proxy_cleanup(void *data)
445413
446414 if (gcf -> handler ) {
447415 IP2Proxy_close (gcf -> handler );
448-
449- if (gcf -> access_type == IP2PROXY_SHARED_MEMORY ) {
450- IP2Proxy_DB_del_shm ();
451- }
452-
453416 gcf -> handler = NULL ;
454417 }
455418}
0 commit comments