[banshee] Don't require explicit proxy action, default home
- From: Aaron Bockover <abock src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Don't require explicit proxy action, default home
- Date: Mon, 2 Aug 2010 18:13:16 +0000 (UTC)
commit d1af3562833a824ac8622d8961d072635b8e3d50
Author: Aaron Bockover <abockover novell com>
Date: Mon Aug 2 14:12:41 2010 -0400
Don't require explicit proxy action, default home
E.g. ommiting any path against redirect.do will use default action
(home) and always use geolocation.
.../Banshee.AmazonMp3.Store/server/redirect.c | 21 +++++++++----------
1 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/server/redirect.c b/src/Extensions/Banshee.AmazonMp3.Store/server/redirect.c
index 594d995..591626d 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/server/redirect.c
+++ b/src/Extensions/Banshee.AmazonMp3.Store/server/redirect.c
@@ -52,26 +52,25 @@ main (gint argc, gchar **argv)
gchar *p;
gchar *dest_url;
+ country = NULL;
+ input = NULL;
+ action = NULL;
+
remote_addr = g_getenv ("REMOTE_ADDR");
path_parts = g_strsplit (path_info = g_getenv ("PATH_INFO"), "/", 4);
- if (path_parts == NULL ||
- path_parts[0] == NULL ||
- (country = path_parts[1]) == NULL) {
- return 1;
- }
-
- input = NULL;
- action = NULL;
- if ((action = path_parts[2]) != NULL) {
+ if (path_parts != NULL &&
+ path_parts[0] != NULL &&
+ (country = path_parts[1]) != NULL &&
+ (action = path_parts[2]) != NULL) {
input = path_parts[3];
}
-
+
if ((p = strrchr (remote_addr, ':')) != NULL) {
remote_addr = p + 1;
}
- if (strcmp (country, "geo") == 0) {
+ if (country == NULL || strcmp (country, "geo") == 0) {
geoip = GeoIP_new (GEOIP_STANDARD);
country = GeoIP_country_code_by_name (geoip, remote_addr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]