proxy: support both new and legacy argument type
authorMunkyu Im <munkyu.im@samsung.com>
Wed, 29 Apr 2015 07:01:23 +0000 (16:01 +0900)
committerMunkyu Im <munkyu.im@samsung.com>
Wed, 29 Apr 2015 07:01:23 +0000 (16:01 +0900)
get http_proxy information from all type now.

Change-Id: Ic2acb78a1a13f385099826a882892d47c5535f3b
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
tizen/src/emulator.c
tizen/src/skin/maruskin_client.c

index bc41fcdde9c04d6207e58eb2da5bfaee7d8bae46..ad1b7d9fd20eedb9edaf7979d820c378982cdb7a 100644 (file)
@@ -172,9 +172,13 @@ static void print_options_info(void)
     fprintf(stdout, "\n====================================================\n");
 }
 
-static void http_proxy_setup(void)
+static void http_proxy_setup(gchar * const kernel_cmdline)
 {
+#ifdef SUPPORT_LEGACY_ARGS
+    char *buf = strstr(kernel_cmdline, HTTP_PROXY_PREFIX);
+#else
     char *buf = get_variable("network_proxy");
+#endif
     gchar** proxy;
     if (buf) {
         char http_proxy[MAXLEN] = {0,};
@@ -226,6 +230,8 @@ static void prepare_basic_features(gchar * const kernel_cmdline)
             " vm_resolution=%dx%d", get_emul_vm_base_port(),
             get_emul_resolution_width(), get_emul_resolution_height());
 
+    http_proxy_setup(kernel_cmdline);
+
     g_strlcat(kernel_cmdline, tmp_str, LEN_MARU_KERNEL_CMDLINE);
 
     g_free(tmp_str);
@@ -400,9 +406,6 @@ static int emulator_main(int argc, char *argv[], char **envp)
         g_strfreev(splitted);
     }
 
-    // set host proxy
-    http_proxy_setup();
-
     // assemble arguments for qemu and skin
     if (!assemble_profile_args(&_qemu_argc, _qemu_argv,
                         &_skin_argc, _skin_argv)) {
index 31f6ec7cb82f1361ff7355e2772dcbb736eb6605..953019aa25023e680c8a6f9a3adc3bb9497178d3 100644 (file)
@@ -66,6 +66,8 @@ MULTI_DEBUG_CHANNEL(qemu, skinclient);
 #define OPT_INPUT_MOUSE "input.mouse"
 #define OPT_INPUT_TOUCH "input.touch"
 #define OPT_MAX_TOUCHPOINT "input.touch.maxpoint"
+#define OPT_PROXY_ADDR "proxy.addr"
+#define OPT_PROXY_PORT "proxy.port"
 
 #define OPT_BOOLEAN_TRUE "true"
 #define OPT_BOOLEAN_FALSE "false"
@@ -133,10 +135,19 @@ static void *run_skin_client(void *arg)
     }
 
     /* network */
-    char buf_proxy_addr[MAX_ADDR_LEN] = { 0, };
-    char buf_proxy_port[MAX_PORT_LEN] = { 0, };
-    sprintf(buf_proxy_addr, "%s", get_emul_http_proxy_addr());
-    sprintf(buf_proxy_port, "%s", get_emul_http_proxy_port());
+    gchar const* proxy_addr;
+    int proxy_addr_len = 0;
+
+    if (get_emul_http_proxy_addr() == NULL) {
+        proxy_addr = g_strdup_printf("%s= %s=",
+                OPT_PROXY_ADDR, OPT_PROXY_PORT);
+        proxy_addr_len = (int)strlen(proxy_addr);
+    } else {
+        proxy_addr = g_strdup_printf("%s=%s %s=%s",
+                OPT_PROXY_ADDR, get_emul_http_proxy_addr(),
+                OPT_PROXY_PORT, get_emul_http_proxy_port());
+        proxy_addr_len = (int)strlen(proxy_addr);
+    }
 
 #ifdef CONFIG_WIN32
     /* find java path in 64bit windows */
@@ -194,7 +205,8 @@ static void *run_skin_client(void *arg)
         strlen(buf_input) + EQUAL_LEN +
             strlen(OPT_BOOLEAN_TRUE) + SPACE_LEN +
         strlen(OPT_MAX_TOUCHPOINT) + EQUAL_LEN +
-            len_maxtouchpoint + SPACE_LEN + 1 +
+            len_maxtouchpoint + SPACE_LEN +
+        proxy_addr_len + SPACE_LEN + 1 +
         strlen(argv);
 
     INFO("skin command length : %d\n", cmd_len);
@@ -214,6 +226,7 @@ static void *run_skin_client(void *arg)
 %s=%s \
 %s=%s \
 %s=%d \
+%s \
 %s",
         JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAVA_LIBRARY_PATH,
 #ifdef CONFIG_WIN32
@@ -228,6 +241,7 @@ static void *run_skin_client(void *arg)
         OPT_DISPLAY_SHM, buf_display_shm,
         buf_input, OPT_BOOLEAN_TRUE,
         OPT_MAX_TOUCHPOINT, maxtouchpoint,
+        proxy_addr,
         argv);
 
     INFO("command for swt : %s\n", cmd);