366 ucx_map_sstr_put(map, key, value.ptr); |
366 ucx_map_sstr_put(map, key, value.ptr); |
367 |
367 |
368 free(key.ptr); |
368 free(key.ptr); |
369 |
369 |
370 return sbuffer.length; |
370 return sbuffer.length; |
|
371 } |
|
372 |
|
373 int util_path_isrelated(const char *path1, const char *path2) { |
|
374 scstr_t p1 = scstr(path1); |
|
375 scstr_t p2 = scstr(path2); |
|
376 |
|
377 if(p1.ptr[p1.length-1] == '/') { |
|
378 p1.length--; |
|
379 } |
|
380 if(p2.ptr[p2.length-1] == '/') { |
|
381 p2.length--; |
|
382 } |
|
383 |
|
384 if(p2.length < p1.length) { |
|
385 return 0; |
|
386 } |
|
387 |
|
388 if(!sstrcmp(p1, p2)) { |
|
389 return 1; |
|
390 } |
|
391 |
|
392 if(sstrprefix(p2, p1)) { |
|
393 if(p2.ptr[p1.length] == '/') { |
|
394 return 1; |
|
395 } |
|
396 } |
|
397 |
|
398 return 0; |
371 } |
399 } |
372 |
400 |
373 void util_capture_header(CURL *handle, UcxMap* map) { |
401 void util_capture_header(CURL *handle, UcxMap* map) { |
374 if(map) { |
402 if(map) { |
375 curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, util_header_callback); |
403 curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, util_header_callback); |