Fixed bug.(GET request detection)
[chise/kage.git] / kagecgi / kagecgi.c
index 4a92461..b96e2bf 100755 (executable)
@@ -27,14 +27,16 @@ int main(int argc, char *argv[]){
        \r
        //confirm request\r
        type = 0;\r
-       //argv\r
-       tmp1 = g_string_new((gchar *)argv[1]);\r
-       if(tmp1->len != 0) type = 1;\r
-       //direct\r
+       //GET request\r
        if(type == 0){\r
          tmp1 = g_string_new((gchar *)getenv("QUERY_STRING"));\r
          if(tmp1->len != 0) type = 2;\r
        }\r
+       //argv(detect after GET request)\r
+       if(type == 0){
+               tmp1 = g_string_new((gchar *)argv[1]);\r
+               if(tmp1->len != 0) type = 1;
+       }
        //redirect\r
        if(type == 0){\r
          tmp1 = g_string_new((gchar *)getenv("REDIRECT_URL"));\r
@@ -48,7 +50,7 @@ int main(int argc, char *argv[]){
        pos = tmp1->str;\r
        \r
        //separate token\r
-       if(type == 1 || type == 2){ //argv or direct\r
+       if(type == 1 || type == 2){ //argv or GET request\r
                while(1){\r
                        cur = strchr(pos, '&');\r
                        tmp2 = g_string_new(pos);\r