MCPcopy Create free account
hub / github.com/apache/skywalking-php / hook_curl_setopt_array

Method hook_curl_setopt_array

src/plugin/plugin_curl.rs:131–149  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

129 }
130
131 fn hook_curl_setopt_array(&self) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) {
132 (
133 Box::new(|_, execute_data| {
134 validate_num_args(execute_data, 2)?;
135
136 let cid = Self::get_resource_id(execute_data)?;
137
138 if let Some(opts) = execute_data.get_parameter(1).as_z_arr() {
139 if let Some(value) = opts.get(CURLOPT_HTTPHEADER as u64) {
140 CURL_HEADERS
141 .with(|headers| headers.borrow_mut().insert(cid, value.clone()));
142 }
143 }
144
145 Ok(Box::new(()))
146 }),
147 Noop::noop(),
148 )
149 }
150
151 fn hook_curl_exec(&self) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) {
152 (

Callers 1

hookMethod · 0.80

Calls 1

validate_num_argsFunction · 0.85

Tested by

no test coverage detected