Skip to content
This repository has been archived by the owner on Apr 5, 2018. It is now read-only.

Commit

Permalink
Provide GEOIP_COUNTRY_CODE, GEOIP_CONTINENT_CODE and GEOIP_COUNTRY_NA…
Browse files Browse the repository at this point in the history
…ME only if the country is known. ( Boris Zentner )
  • Loading branch information
borisz committed Jun 11, 2008
1 parent 003eefb commit 6022e91
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
4 changes: 3 additions & 1 deletion Changes
@@ -1,4 +1,6 @@
- Add GEOIP_ADDR thats the address used to compute the geoip information. Exported as env, notes or both as usual ( Jason Caldwell )
1.2.4 Jun 10th 2008
! mod_geoip2 has sets GEOIP_COUNTRY_CODE to -- for unknown countries when used with the country database. But for any other database ( City for example ) GEOIP_COUNTRY_CODE is unset for unknown countries. This is fixed now. Same for GEOIP_CONTINENT_CODE and GEOIP_COUNTRY_NAME. ( Boris Zentner )
- Add GEOIP_ADDR. That's the address used to compute the geoip information. Exported as env, notes or both as usual ( Jason Caldwell )
- Try to run always before mod_setenvif and mod_rewrite. ( Boris Zentner )
1.2.3 Apr 26th 2008
- Skip files that we can not open for some reason ( permission/typo ). Check and skip empty slots in geoip_header_parser ( Boris Zentner )
Expand Down
44 changes: 23 additions & 21 deletions mod_geoip.c
Expand Up @@ -433,27 +433,29 @@ geoip_header_parser(request_rec * r)
/* Get the Country ID */
country_id = GeoIP_country_id_by_addr(cfg->gips[i], ipaddr);

/* Lookup the Code and the Name with the ID */
continent_code = GeoIP_country_continent[country_id];
country_code = GeoIP_country_code[country_id];
country_name = GeoIP_country_name[country_id];

if (cfg->numGeoIPFiles == 0) {
cfg->numGeoIPFiles = 0;
}
if (cfg->GeoIPFilenames == 0) {
cfg->GeoIPFilenames = 0;
}
/* Set it for our user */
if (cfg->GeoIPOutput & GEOIP_NOTES) {
apr_table_setn(r->notes, "GEOIP_CONTINENT_CODE", continent_code);
apr_table_setn(r->notes, "GEOIP_COUNTRY_CODE", country_code);
apr_table_setn(r->notes, "GEOIP_COUNTRY_NAME", country_name);
}
if (cfg->GeoIPOutput & GEOIP_ENV) {
apr_table_setn(r->subprocess_env, "GEOIP_CONTINENT_CODE", continent_code);
apr_table_setn(r->subprocess_env, "GEOIP_COUNTRY_CODE", country_code);
apr_table_setn(r->subprocess_env, "GEOIP_COUNTRY_NAME", country_name);
if ( country_id > 0 ) {
/* Lookup the Code and the Name with the ID */
continent_code = GeoIP_country_continent[country_id];
country_code = GeoIP_country_code[country_id];
country_name = GeoIP_country_name[country_id];

if (cfg->numGeoIPFiles == 0) {
cfg->numGeoIPFiles = 0;
}
if (cfg->GeoIPFilenames == 0) {
cfg->GeoIPFilenames = 0;
}
/* Set it for our user */
if (cfg->GeoIPOutput & GEOIP_NOTES) {
apr_table_setn(r->notes, "GEOIP_CONTINENT_CODE", continent_code);
apr_table_setn(r->notes, "GEOIP_COUNTRY_CODE", country_code);
apr_table_setn(r->notes, "GEOIP_COUNTRY_NAME", country_name);
}
if (cfg->GeoIPOutput & GEOIP_ENV) {
apr_table_setn(r->subprocess_env, "GEOIP_CONTINENT_CODE", continent_code);
apr_table_setn(r->subprocess_env, "GEOIP_COUNTRY_CODE", country_code);
apr_table_setn(r->subprocess_env, "GEOIP_COUNTRY_NAME", country_name);
}
}
break;
case GEOIP_REGION_EDITION_REV0:
Expand Down

0 comments on commit 6022e91

Please sign in to comment.