MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlNanoFTPUpdateURL

Function xmlNanoFTPUpdateURL

ThirdParty/libxml2/vtklibxml2/nanoftp.c:335–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333 */
334
335int
336xmlNanoFTPUpdateURL(void *ctx, const char *URL) {
337 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
338 xmlURIPtr uri;
339
340 if (URL == NULL)
341 return(-1);
342 if (ctxt == NULL)
343 return(-1);
344 if (ctxt->protocol == NULL)
345 return(-1);
346 if (ctxt->hostname == NULL)
347 return(-1);
348
349 uri = xmlParseURIRaw(URL, 1);
350 if (uri == NULL)
351 return(-1);
352
353 if ((uri->scheme == NULL) || (uri->server == NULL)) {
354 xmlFreeURI(uri);
355 return(-1);
356 }
357 if ((strcmp(ctxt->protocol, uri->scheme)) ||
358 (strcmp(ctxt->hostname, uri->server)) ||
359 ((uri->port != 0) && (ctxt->port != uri->port))) {
360 xmlFreeURI(uri);
361 return(-1);
362 }
363
364 if (uri->port != 0)
365 ctxt->port = uri->port;
366
367 if (ctxt->path != NULL) {
368 xmlFree(ctxt->path);
369 ctxt->path = NULL;
370 }
371
372 if (uri->path == NULL)
373 ctxt->path = xmlMemStrdup("/");
374 else
375 ctxt->path = xmlMemStrdup(uri->path);
376
377 xmlFreeURI(uri);
378
379 return(0);
380}
381
382/**
383 * xmlNanoFTPScanProxy:

Callers

nothing calls this directly

Calls 2

xmlParseURIRawFunction · 0.85
xmlFreeURIFunction · 0.85

Tested by

no test coverage detected