Skip to content

Commit

Permalink
re-api: fix parsing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Sep 19, 2022
1 parent 46a362c commit 7730833
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,15 +1077,18 @@ static struct char_buffer parseFetch(struct apiCon *con, struct char_buffer *req
char *req = request->buffer;

// GET URL HTTPVERSION
// skip URL to after ? which signifies start of query options
char *query = memchr(req, '?', request->len) + 1;
if (!query)
char *query = memchr(req, '?', request->len);
if (!query) {
return invalid;
}
// skip URL to after ? which signifies start of query options
query++;

// find end of query
char *eoq = memchr(query, ' ', request->len);
if (!eoq)
if (!eoq) {
return invalid;
}

// we only want the URL
*eoq = '\0';
Expand Down
4 changes: 3 additions & 1 deletion checkapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ queries+=("?all&filter_callsign_prefix=DLH&jv2")
queries+=("?all_with_pos&filter_mil&jv2")
queries+=("?all_with_pos&filter_ladd&jv2")
queries+=("?all_with_pos&filter_squawk=1000&jv2")
queries+=("?box=50,60,-5,5")
queries+=("/re-api/")


queries+=("?box=50,60,-5,5")
#queries=()
queries+=("?all")
queries+=("?all_with_pos")
Expand Down

0 comments on commit 7730833

Please sign in to comment.