MCPcopy Create free account
hub / github.com/apache/trafficserver / setKeyVal

Method setKeyVal

plugins/slice/HttpHeader.cc:203–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203bool
204HttpHeader::setKeyVal(char const *const keystr, int const keylen, char const *const valstr, int const vallen, int const index)
205{
206 if (!isValid()) {
207 return false;
208 }
209
210 bool status(false);
211
212 TSMLoc locfield(TSMimeHdrFieldFind(m_buffer, m_lochdr, keystr, keylen));
213
214 if (nullptr != locfield) {
215 status = TS_SUCCESS == TSMimeHdrFieldValueStringSet(m_buffer, m_lochdr, locfield, index, valstr, vallen);
216 } else {
217 int rcode = TSMimeHdrFieldCreateNamed(m_buffer, m_lochdr, keystr, keylen, &locfield);
218
219 if (TS_SUCCESS == rcode) {
220 rcode = TSMimeHdrFieldValueStringSet(m_buffer, m_lochdr, locfield, index, valstr, vallen);
221 if (TS_SUCCESS == rcode) {
222 rcode = TSMimeHdrFieldAppend(m_buffer, m_lochdr, locfield);
223 status = (TS_SUCCESS == rcode);
224 }
225 }
226 }
227
228 if (nullptr != locfield) {
229 TSHandleMLocRelease(m_buffer, m_lochdr, locfield);
230 }
231
232 return status;
233}
234
235bool
236HttpHeader::timeForKey(char const *const keystr, int const keylen, time_t *const timeval) const

Callers 6

handleFirstServerHeaderFunction · 0.80
request_blockFunction · 0.80
handle_client_reqFunction · 0.80
read_requestFunction · 0.80
fetchMethod · 0.80
form416HeaderAndBodyFunction · 0.80

Calls 5

TSMimeHdrFieldFindFunction · 0.85
TSMimeHdrFieldAppendFunction · 0.85
TSHandleMLocReleaseFunction · 0.85

Tested by

no test coverage detected