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

Function do_tests

tools/ipptool.c:2222–2267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2220 */
2221
2222static int /* O - 1 on success, 0 on failure */
2223do_tests(const char *testfile, /* I - Test file to use */
2224 ipptool_test_t *data) /* I - Test data */
2225{
2226 http_encryption_t encryption; /* Encryption mode */
2227
2228
2229 /*
2230 * Connect to the printer/server...
2231 */
2232
2233 if (!_cups_strcasecmp(data->vars->scheme, "https") || !_cups_strcasecmp(data->vars->scheme, "ipps") || data->vars->port == 443)
2234 encryption = HTTP_ENCRYPTION_ALWAYS;
2235 else
2236 encryption = data->encryption;
2237
2238 if ((data->http = httpConnect2(data->vars->host, data->vars->port, NULL, data->family, encryption, 1, 30000, NULL)) == NULL)
2239 {
2240 print_fatal_error(data, "Unable to connect to \"%s\" on port %d - %s", data->vars->host, data->vars->port, cupsLastErrorString());
2241 return (0);
2242 }
2243
2244#ifdef HAVE_LIBZ
2245 httpSetDefaultField(data->http, HTTP_FIELD_ACCEPT_ENCODING, "deflate, gzip, identity");
2246#else
2247 httpSetDefaultField(data->http, HTTP_FIELD_ACCEPT_ENCODING, "identity");
2248#endif /* HAVE_LIBZ */
2249
2250 if (data->timeout > 0.0)
2251 httpSetTimeout(data->http, data->timeout, timeout_cb, NULL);
2252
2253 /*
2254 * Run tests...
2255 */
2256
2257 _ippFileParse(data->vars, testfile, (void *)data);
2258
2259 /*
2260 * Close connection and return...
2261 */
2262
2263 httpClose(data->http);
2264 data->http = NULL;
2265
2266 return (data->pass);
2267}
2268
2269
2270/*

Callers 2

mainFunction · 0.85
token_cbFunction · 0.85

Calls 8

_cups_strcasecmpFunction · 0.85
httpConnect2Function · 0.85
print_fatal_errorFunction · 0.85
cupsLastErrorStringFunction · 0.85
httpSetDefaultFieldFunction · 0.85
httpSetTimeoutFunction · 0.85
_ippFileParseFunction · 0.85
httpCloseFunction · 0.85

Tested by

no test coverage detected