Skip to content

Commit

Permalink
omit :70 from Gopher URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed May 6, 2023
1 parent 95fcb22 commit ad565f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gopher.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void parse_gophermap_line(char *line, int *pre, Selector **sel, SelectorL

(*sel)->repr = str_copy(line + 1);

if ((*line == '1' || *line == '0' || *line == '7' || *line == '9' || *line == 'g' || *line == 'I' || *line == '8' || *line == '2' || *line == '6' || *line == '5' || *line == '4' || *line == 'T') && asprintf(&(*sel)->rawurl, "%s://%s:%s/%c%s", "gopher", host, port, *line, path) < 0) { (*sel)->rawurl = NULL; goto fail; }
if ((*line == '1' || *line == '0' || *line == '7' || *line == '9' || *line == 'g' || *line == 'I' || *line == '8' || *line == '2' || *line == '6' || *line == '5' || *line == '4' || *line == 'T') && (strcmp(port, "70") == 0 ? asprintf(&(*sel)->rawurl, "%s://%s/%c%s", "gopher", host, *line, path) : asprintf(&(*sel)->rawurl, "%s://%s:%s/%c%s", "gopher", host, port, *line, path)) < 0) { (*sel)->rawurl = NULL; goto fail; }
else if (*line == 'h' && strncmp(path, "URL:", 4) == 0 && !copy_url(*sel, path + 4)) goto fail;

SIMPLEQ_INSERT_TAIL(list, *sel, next);
Expand Down

0 comments on commit ad565f1

Please sign in to comment.