MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cups_get_url

Function cups_get_url

cups/ppd-cache.c:5412–5441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5410 */
5411
5412static int /* O - 1 on success, 0 on failure */
5413cups_get_url(http_t **http, /* IO - Current HTTP connection */
5414 const char *url, /* I - URL to get */
5415 char *name, /* I - Temporary filename */
5416 size_t namesize) /* I - Size of temporary filename buffer */
5417{
5418 char resource[256]; /* URL resource */
5419 http_status_t status; /* Status of GET request */
5420 int fd; /* Temporary file */
5421
5422
5423 if (!cups_connect(http, url, resource, sizeof(resource)))
5424 return (0);
5425
5426 if ((fd = cupsTempFd(name, (int)namesize)) < 0)
5427 return (0);
5428
5429 status = cupsGetFd(*http, resource, fd);
5430
5431 close(fd);
5432
5433 if (status != HTTP_STATUS_OK)
5434 {
5435 unlink(name);
5436 *name = '\0';
5437 return (0);
5438 }
5439
5440 return (1);
5441}
5442
5443
5444/*

Callers 1

_ppdCreateFromIPP2Function · 0.85

Calls 3

cups_connectFunction · 0.85
cupsTempFdFunction · 0.85
cupsGetFdFunction · 0.85

Tested by

no test coverage detected