> > I was less concerned with the overhead of the strbuf (http requests are > pretty heavyweight already) and more that it could simplify your parsing > if you could just do it left-to-right on a single line: > > char *line = xmemdupz(buffer, size); > const char *p = line; > if (skip_iprefix(p, "retry-after:", &p)) { > char *end; > while (isspace(*p)) > p++; > opts->retry_after = strtol(p, &end, 10); > /* if you want to be pedantic */ > if (*end && *end != '\r' && *end != '\n') > opts->retry_after = 0; /* warn, too? */ > } > > If you want to be clever, you could probably avoid the extra allocation, > but I think being able to parse with simple string functions makes it > much more obvious that we don't walk off the end of the input. > The latest code effectively does this per Dosch' suggestion. No more string splitting, it just parses it as a single big string as you mention. It sounds like we're quickly settling on using CURLINFO_RETRY_AFTER when available, and not retrying otherwise, so it might be OBE.