|
1 | 1 | // |
2 | 2 | // HTTP address routines for CUPS. |
3 | 3 | // |
4 | | -// Copyright © 2023-2025 by OpenPrinting. |
| 4 | +// Copyright © 2023-2026 by OpenPrinting. |
5 | 5 | // Copyright © 2007-2021 by Apple Inc. |
6 | 6 | // Copyright © 1997-2006 by Easy Software Products, all rights reserved. |
7 | 7 | // |
@@ -373,7 +373,7 @@ httpAddrLookup( |
373 | 373 | #endif // AF_LOCAL |
374 | 374 |
|
375 | 375 | // Optimize lookups for localhost/loopback addresses... |
376 | | - if (httpAddrLocalhost(addr)) |
| 376 | + if (httpAddrIsLocalhost(addr)) |
377 | 377 | { |
378 | 378 | cupsCopyString(name, "localhost", (size_t)namelen); |
379 | 379 | return (name); |
@@ -401,12 +401,12 @@ httpAddrLookup( |
401 | 401 | // |
402 | 402 | // FWIW, I think this is really a bug in the implementation of |
403 | 403 | // getnameinfo(), but falling back on httpAddrString() is easy to do... |
404 | | - if ((error = getnameinfo(&addr->addr, (socklen_t)httpAddrLength(addr), name, (socklen_t)namelen, NULL, 0, 0)) != 0) |
| 404 | + if ((error = getnameinfo(&addr->addr, (socklen_t)httpAddrLength(addr), name, (socklen_t)namelen, NULL, 0, 0)) != 0 || !strcasecmp(name, "localhost")) |
405 | 405 | { |
406 | 406 | if (error == EAI_FAIL) |
407 | 407 | cg->need_res_init = 1; |
408 | 408 |
|
409 | | - return (httpAddrGetString(addr, name, (size_t)namelen)); |
| 409 | + httpAddrGetString(addr, name, (size_t)namelen); |
410 | 410 | } |
411 | 411 |
|
412 | 412 | DEBUG_printf("1httpAddrLookup: returning \"%s\"...", name); |
|
0 commit comments