Skip to content

Commit 6597e5b

Browse files
committed
Add some debug printfs for User-Agent.
1 parent 056059a commit 6597e5b

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

cups/http.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3700,9 +3700,15 @@ http_send(http_t *http, // I - HTTP connection
37003700
if (!http->fields[HTTP_FIELD_USER_AGENT])
37013701
{
37023702
if (http->default_fields[HTTP_FIELD_USER_AGENT])
3703+
{
3704+
DEBUG_puts("5http_send: Using default User-Agent.");
37033705
httpSetField(http, HTTP_FIELD_USER_AGENT, http->default_fields[HTTP_FIELD_USER_AGENT]);
3706+
}
37043707
else
3708+
{
3709+
DEBUG_puts("5http_send: Using client.conf User-Agent.");
37053710
httpSetField(http, HTTP_FIELD_USER_AGENT, cupsGetUserAgent());
3711+
}
37063712
}
37073713

37083714
// Set the Accept-Encoding field if it isn't already...
@@ -3743,7 +3749,7 @@ http_send(http_t *http, // I - HTTP connection
37433749
if (http->encryption == HTTP_ENCRYPTION_REQUIRED && !http->tls)
37443750
{
37453751
httpSetField(http, HTTP_FIELD_CONNECTION, "Upgrade");
3746-
httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.2,TLS/1.1,TLS/1.0");
3752+
httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.3,TLS/1.2,TLS/1.1,TLS/1.0");
37473753
}
37483754

37493755
if (httpPrintf(http, "%s %s HTTP/1.1\r\n", codes[request], buf) < 1)

cups/usersys.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,12 +459,17 @@ cupsSetUserAgent(const char *user_agent)// I - User-Agent string or `NULL`
459459
#endif // _WIN32
460460

461461

462+
DEBUG_printf("cupsSetUserAgent(\"%s\")", user_agent);
463+
462464
if (user_agent)
463465
{
464466
cupsCopyString(cg->user_agent, user_agent, sizeof(cg->user_agent));
467+
DEBUG_printf("1cupsSetUserAgent: user_agent=\"%s\"", cg->user_agent);
465468
return;
466469
}
467470

471+
DEBUG_printf("1cupsSetUserAgent: uatokens=%d(%s)", cg->uatokens, uatokens[cg->uatokens]);
472+
468473
if (cg->uatokens < _CUPS_UATOKENS_OS)
469474
{
470475
switch (cg->uatokens)
@@ -487,6 +492,7 @@ cupsSetUserAgent(const char *user_agent)// I - User-Agent string or `NULL`
487492
break;
488493
}
489494

495+
DEBUG_printf("1cupsSetUserAgent: user_agent=\"%s\"", cg->user_agent);
490496
return;
491497
}
492498

@@ -568,6 +574,8 @@ cupsSetUserAgent(const char *user_agent)// I - User-Agent string or `NULL`
568574
else
569575
snprintf(cg->user_agent, sizeof(cg->user_agent), "CUPS/" LIBCUPS_VERSION " (%s %s; %s) IPP/2.0", name.sysname, name.release, name.machine);
570576
#endif // _WIN32
577+
578+
DEBUG_printf("1cupsSetUserAgent: user_agent=\"%s\"", cg->user_agent);
571579
}
572580

573581

@@ -606,6 +614,8 @@ cupsGetUserAgent(void)
606614
if (!cg->user_agent[0])
607615
cupsSetUserAgent(NULL);
608616

617+
DEBUG_printf("1cupsGetUserAgent: Returning \"%s\".", cg->user_agent);
618+
609619
return (cg->user_agent);
610620
}
611621

0 commit comments

Comments
 (0)