//
// HTTP routines for CUPS.
//
-// Copyright © 2022-2024 by OpenPrinting.
+// Copyright © 2022-2025 by OpenPrinting.
// Copyright © 2007-2021 by Apple Inc.
// Copyright © 1997-2007 by Easy Software Products, all rights reserved.
//
const char *data) // I - Auth data (NULL for none)
{
// Range check input...
+ DEBUG_printf("httpSetAuthString(http=%p, scheme=\"%s\", data=\"%s\")", (void *)http, scheme, data);
+
if (!http)
return;
// Clear the current authorization string...
http->_authstring[0] = '\0';
}
+
+ DEBUG_printf("1httpSetAuthString: authstring=\"%s\"", http->authstring);
}
if (!http->fields[HTTP_FIELD_ACCEPT_ENCODING] && http->default_fields[HTTP_FIELD_ACCEPT_ENCODING])
httpSetField(http, HTTP_FIELD_ACCEPT_ENCODING, http->default_fields[HTTP_FIELD_ACCEPT_ENCODING]);
+ // Set the Authorization field if it isn't already...
+ if (!http->fields[HTTP_FIELD_AUTHORIZATION] && http->authstring)
+ httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
+
// Encode the URI as needed...
_httpEncodeURI(buf, uri, sizeof(buf));
//
// ipptool command for CUPS.
//
-// Copyright © 2020-2024 by OpenPrinting.
+// Copyright © 2020-2025 by OpenPrinting.
// Copyright © 2020 by The Printer Working Group.
// Copyright © 2007-2021 by Apple Inc.
// Copyright © 1997-2007 by Easy Software Products.
}
if (data->bearer_token)
- httpSetAuthString(data->http, "Bearer", data->bearer_token);
+ httpSetAuthString(http, "Bearer", data->bearer_token);
- httpSetDefaultField(data->http, HTTP_FIELD_ACCEPT_ENCODING, "deflate, gzip, identity");
+ httpSetDefaultField(http, HTTP_FIELD_ACCEPT_ENCODING, "deflate, gzip, identity");
if (data->timeout > 0.0)
httpSetTimeout(http, data->timeout, timeout_cb, NULL);