| 324 | */ |
| 325 | |
| 326 | static void |
| 327 | cups_create_localizations( |
| 328 | http_t *http, /* I - Connection to destination */ |
| 329 | cups_dinfo_t *dinfo) /* I - Destination information */ |
| 330 | { |
| 331 | http_t *http2; /* Connection for strings file */ |
| 332 | http_status_t status; /* Request status */ |
| 333 | ipp_attribute_t *attr; /* "printer-strings-uri" attribute */ |
| 334 | char scheme[32], /* URI scheme */ |
| 335 | userpass[256], /* Username/password info */ |
| 336 | hostname[256], /* Hostname */ |
| 337 | resource[1024], /* Resource */ |
| 338 | http_hostname[256], |
| 339 | /* Hostname of connection */ |
| 340 | tempfile[1024]; /* Temporary filename */ |
| 341 | int port; /* Port number */ |
| 342 | http_encryption_t encryption; /* Encryption to use */ |
| 343 | cups_file_t *temp; /* Temporary file */ |
| 344 | |
| 345 | |
| 346 | /* |
| 347 | * See if there are any localizations... |
| 348 | */ |
| 349 | |
| 350 | if ((attr = ippFindAttribute(dinfo->attrs, "printer-strings-uri", |
| 351 | IPP_TAG_URI)) == NULL) |
| 352 | { |
| 353 | /* |
| 354 | * Nope, create an empty message catalog... |
| 355 | */ |
| 356 | |
| 357 | dinfo->localizations = _cupsMessageNew(NULL); |
| 358 | DEBUG_puts("4cups_create_localizations: No printer-strings-uri (uri) value."); |
| 359 | return; |
| 360 | } |
| 361 | |
| 362 | /* |
| 363 | * Pull apart the URI and determine whether we need to try a different |
| 364 | * server... |
| 365 | */ |
| 366 | |
| 367 | if (httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[0].string.text, |
| 368 | scheme, sizeof(scheme), userpass, sizeof(userpass), |
| 369 | hostname, sizeof(hostname), &port, resource, |
| 370 | sizeof(resource)) < HTTP_URI_STATUS_OK) |
| 371 | { |
| 372 | dinfo->localizations = _cupsMessageNew(NULL); |
| 373 | DEBUG_printf(("4cups_create_localizations: Bad printer-strings-uri value \"%s\".", attr->values[0].string.text)); |
| 374 | return; |
| 375 | } |
| 376 | |
| 377 | httpGetHostname(http, http_hostname, sizeof(http_hostname)); |
| 378 | |
| 379 | if (!_cups_strcasecmp(http_hostname, hostname) && |
| 380 | port == httpAddrPort(http->hostaddr)) |
| 381 | { |
| 382 | /* |
| 383 | * Use the same connection... |
no test coverage detected