Skip to content

Commit

Permalink
Use httpSetDefaultField
Browse files Browse the repository at this point in the history
  • Loading branch information
zdohnal committed Dec 16, 2024
1 parent a1169ec commit e86c381
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions cups/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -3650,9 +3650,6 @@ http_add_field(http_t *http, /* I - HTTP connection */
{
if (field < HTTP_FIELD_ACCEPT_ENCODING)
http->_fields[field][0] = '\0';
else if (field == HTTP_FIELD_SERVER)
http->fields[HTTP_FIELD_SERVER] = (char*)calloc(1, sizeof(char));

return;
}

Expand Down
10 changes: 7 additions & 3 deletions scheduler/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
con->serverport = httpAddrPort(&(lis->address));
}

/*
* Apply ServerHeader if any
*/

if (ServerHeader)
httpSetDefaultField(con->http, HTTP_FIELD_SERVER, ServerHeader);

/*
* Add the connection to the array of active clients...
*/
Expand Down Expand Up @@ -2146,9 +2153,6 @@ cupsdSendHeader(
code = HTTP_STATUS_OK;
}

if (ServerHeader)
httpSetField(con->http, HTTP_FIELD_SERVER, ServerHeader);

if (code == HTTP_STATUS_METHOD_NOT_ALLOWED)
httpSetField(con->http, HTTP_FIELD_ALLOW, "GET, HEAD, OPTIONS, POST, PUT");

Expand Down

0 comments on commit e86c381

Please sign in to comment.