Advertisement
DragonOsman

query and abs_path in parse()

Nov 30th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. char* temp_path = strchr(line, '/');
  2.     int index = 0;
  3.     for (int length = strlen(temp_path); index < length; index++)
  4.     {
  5.         if (temp_path[index] == ' ' || temp_path[index] == '?')
  6.         {
  7.             break;
  8.         }
  9.     }
  10.     strncpy(abs_path, temp_path, index);
  11.     abs_path[index] = '\0';
  12.     for (int i = 0, n = strlen(abs_path); i < n; i++)
  13.     {
  14.         if (abs_path[i] == '"')
  15.         {
  16.             error(400);
  17.             return false;
  18.         }
  19.     }
  20.    
  21.     char* temp_query = strchr(line, '?');
  22.     if (temp_query != NULL)
  23.     {
  24.         index = 0;
  25.         for (int length = strlen(temp_query); index < length; index++)
  26.         {
  27.             if (temp_query[index] == ' ')
  28.             {
  29.                 break;
  30.             }
  31.         }
  32.         strncpy(query, temp_query, index);
  33.         query[index] = '\0';
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement