MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / write_header

Function write_header

src/runtime.cpp:106–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106static size_t write_header(char* ptr, size_t size, size_t nmemb, void* userdata)
107{
108 if (!ptr) {
109 return 0;
110 }
111
112 logging::log_debug(LOG_TAG, "received header: %s", std::string(ptr, nmemb).c_str());
113
114 auto* const resp = static_cast<http::response*>(userdata);
115 assert(resp);
116 for (size_t i = 0; i < nmemb; i++) {
117 if (ptr[i] != ':') {
118 continue;
119 }
120 resp->add_header(trim({ptr, i}), trim({ptr + i + 1, nmemb - i - 1}));
121 break;
122 }
123 return size * nmemb;
124}
125
126static size_t read_data(char* buffer, size_t size, size_t nitems, void* userdata)
127{

Callers

nothing calls this directly

Calls 3

log_debugFunction · 0.85
trimFunction · 0.85
add_headerMethod · 0.80

Tested by

no test coverage detected