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

Function TSMimeHdrFieldDestroy

src/api/InkAPI.cc:1782–1817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1780}
1781
1782TSReturnCode
1783TSMimeHdrFieldDestroy(TSMBuffer bufp, TSMLoc mh_mloc, TSMLoc field_mloc)
1784{
1785 // Allow to modify the buffer only
1786 // if bufp is modifiable. If bufp is not modifiable return
1787 // TS_ERROR. If allowed, return TS_SUCCESS. Changed the
1788 // return value of function from void to TSReturnCode.
1789 sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS);
1790 sdk_assert((sdk_sanity_check_mime_hdr_handle(mh_mloc) == TS_SUCCESS) ||
1791 (sdk_sanity_check_http_hdr_handle(mh_mloc) == TS_SUCCESS));
1792 sdk_assert(sdk_sanity_check_field_handle(field_mloc, mh_mloc) == TS_SUCCESS);
1793
1794 if (!isWriteable(bufp)) {
1795 return TS_ERROR;
1796 }
1797
1798 MIMEFieldSDKHandle *field_handle = reinterpret_cast<MIMEFieldSDKHandle *>(field_mloc);
1799
1800 if (field_handle->mh == nullptr) { // NOT SUPPORTED!!
1801 ink_release_assert(!"Failed MH");
1802 } else {
1803 MIMEHdrImpl *mh = _hdr_mloc_to_mime_hdr_impl(mh_mloc);
1804 HdrHeap *heap = ((reinterpret_cast<HdrHeapSDKHandle *>(bufp))->m_heap);
1805
1806 ink_assert(mh == field_handle->mh);
1807 if (sdk_sanity_check_field_handle(field_mloc, mh_mloc) != TS_SUCCESS) {
1808 return TS_ERROR;
1809 }
1810
1811 // detach and delete this field, but not all dups
1812 mime_hdr_field_delete(heap, mh, field_handle->field_ptr, false);
1813 }
1814 // for consistence, the handle will not be released here.
1815 // users will be required to do it.
1816 return TS_SUCCESS;
1817}
1818
1819TSReturnCode
1820TSMimeHdrFieldCreate(TSMBuffer bufp, TSMLoc mh_mloc, TSMLoc *locp)

Callers 15

Headers.ccFile · 0.85
eraseMethod · 0.85
set_headerMethod · 0.85
modifyResponseHeaderFunction · 0.85
XDeleteDebugHdrFunction · 0.85
execMethod · 0.85
removeHeaderFunction · 0.85
setHeaderFunction · 0.85
remove_headerFunction · 0.85
set_headerFunction · 0.85
handle_range_requestFunction · 0.85

Calls 7

sdk_sanity_check_mbufferFunction · 0.85
isWriteableFunction · 0.85
mime_hdr_field_deleteFunction · 0.85

Tested by 1