From eae84b6a697b71dbf0fd3d1c293f494e987313d4 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Tue, 21 Jan 2020 20:41:39 -0500 Subject: [PATCH] [core] http_status_append() short-circuit 200 OK --- src/http_kv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/http_kv.c b/src/http_kv.c index b77ab6bf..5c4e89a2 100644 --- a/src/http_kv.c +++ b/src/http_kv.c @@ -154,6 +154,11 @@ http_method_t get_http_method_key(const char *s, size_t slen) { void http_status_append(buffer * const b, const int status) { + if (200 == status) { /*(short-circuit common case)*/ + buffer_append_string_len(b, CONST_STR_LEN("200 OK")); + return; + } + const keyvalue * const kv = http_status; int i; for (i = 0; kv[i].key != status && kv[i].vlen; ++i) ;