src: Refactor a bit
This commit is contained in:
parent
94bf8dcd4e
commit
125e32eb56
16
src/http2.cc
16
src/http2.cc
|
@ -291,24 +291,18 @@ int32_t determine_window_update_transmission(nghttp2_session *session,
|
|||
|
||||
void dump_nv(FILE *out, const char **nv) {
|
||||
for (size_t i = 0; nv[i]; i += 2) {
|
||||
fwrite(nv[i], strlen(nv[i]), 1, out);
|
||||
fwrite(": ", 2, 1, out);
|
||||
fwrite(nv[i + 1], strlen(nv[i + 1]), 1, out);
|
||||
fwrite("\n", 1, 1, out);
|
||||
fprintf(out, "%s: %s\n", nv[i], nv[i + 1]);
|
||||
}
|
||||
fwrite("\n", 1, 1, out);
|
||||
fputc('\n', out);
|
||||
fflush(out);
|
||||
}
|
||||
|
||||
void dump_nv(FILE *out, const nghttp2_nv *nva, size_t nvlen) {
|
||||
auto end = nva + nvlen;
|
||||
for (; nva != end; ++nva) {
|
||||
fwrite(nva->name, nva->namelen, 1, out);
|
||||
fwrite(": ", 2, 1, out);
|
||||
fwrite(nva->value, nva->valuelen, 1, out);
|
||||
fwrite("\n", 1, 1, out);
|
||||
fprintf(out, "%s: %s\n", nva->name, nva->value);
|
||||
}
|
||||
fwrite("\n", 1, 1, out);
|
||||
fputc('\n', out);
|
||||
fflush(out);
|
||||
}
|
||||
|
||||
|
@ -316,7 +310,7 @@ void dump_nv(FILE *out, const Headers &nva) {
|
|||
for (auto &nv : nva) {
|
||||
fprintf(out, "%s: %s\n", nv.name.c_str(), nv.value.c_str());
|
||||
}
|
||||
fwrite("\n", 1, 1, out);
|
||||
fputc('\n', out);
|
||||
fflush(out);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue