MCPcopy Create free account
hub / github.com/apache/brpc / HttpReasonPhrase

Function HttpReasonPhrase

src/brpc/http_status_code.cpp:105–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103static BAIDU_THREAD_LOCAL char tls_phrase_cache[64];
104
105const char *HttpReasonPhrase(int status_code) {
106 pthread_once(&init_reason_phrases_once, InitReasonPhrases);
107 const char* desc = NULL;
108 if (status_code >= 0 &&
109 status_code < (int)ARRAY_SIZE(phrases) &&
110 (desc = phrases[status_code])) {
111 return desc;
112 }
113 snprintf(tls_phrase_cache, sizeof(tls_phrase_cache),
114 "Unknown status code (%d)", status_code);
115 return tls_phrase_cache;
116}
117
118int ErrorCodeToStatusCode(int error_code) {
119 if (error_code == 0) {

Callers 4

TEST_FFunction · 0.85
TESTFunction · 0.85
reason_phraseMethod · 0.85
on_header_valueMethod · 0.85

Calls 1

snprintfFunction · 0.85

Tested by 2

TEST_FFunction · 0.68
TESTFunction · 0.68