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

Function http_hdr_init

src/proxy/hdrs/HTTP.cc:292–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290 -------------------------------------------------------------------------*/
291
292void
293http_hdr_init(HdrHeap *heap, HTTPHdrImpl *hh, HTTPType polarity, HTTPVersion version)
294{
295 memset(&(hh->u), 0, sizeof(hh->u));
296 hh->m_polarity = polarity;
297 hh->m_version = HTTP_1_0;
298 hh->m_fields_impl = mime_hdr_create(heap);
299 if (polarity == HTTP_TYPE_REQUEST) {
300 hh->u.req.m_url_impl = url_create(heap);
301 hh->u.req.m_method_wks_idx = -1;
302 }
303
304 if (version == HTTP_2_0 || version == HTTP_3_0) {
305 MIMEField *field;
306 switch (polarity) {
307 case HTTP_TYPE_REQUEST:
308 field = mime_field_create_named(heap, hh->m_fields_impl, PSEUDO_HEADER_METHOD.data(), PSEUDO_HEADER_METHOD.size());
309 mime_hdr_field_attach(hh->m_fields_impl, field, false, nullptr);
310
311 field = mime_field_create_named(heap, hh->m_fields_impl, PSEUDO_HEADER_SCHEME.data(), PSEUDO_HEADER_SCHEME.size());
312 mime_hdr_field_attach(hh->m_fields_impl, field, false, nullptr);
313
314 field = mime_field_create_named(heap, hh->m_fields_impl, PSEUDO_HEADER_AUTHORITY.data(), PSEUDO_HEADER_AUTHORITY.size());
315 mime_hdr_field_attach(hh->m_fields_impl, field, false, nullptr);
316
317 field = mime_field_create_named(heap, hh->m_fields_impl, PSEUDO_HEADER_PATH.data(), PSEUDO_HEADER_PATH.size());
318 mime_hdr_field_attach(hh->m_fields_impl, field, false, nullptr);
319 break;
320 case HTTP_TYPE_RESPONSE:
321 field = mime_field_create_named(heap, hh->m_fields_impl, PSEUDO_HEADER_STATUS.data(), PSEUDO_HEADER_STATUS.size());
322 mime_hdr_field_attach(hh->m_fields_impl, field, false, nullptr);
323 break;
324 default:
325 ink_abort("HTTP_TYPE_UNKNOWN");
326 }
327 }
328}
329
330/*-------------------------------------------------------------------------
331 -------------------------------------------------------------------------*/

Callers 1

http_hdr_createFunction · 0.85

Calls 8

memsetFunction · 0.85
mime_hdr_createFunction · 0.85
url_createFunction · 0.85
mime_field_create_namedFunction · 0.85
mime_hdr_field_attachFunction · 0.85
ink_abortFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected