OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
958 stars 174 forks source link

scheduler: Fix sending response headers to client #927

Closed zdohnal closed 3 months ago

zdohnal commented 3 months ago

Sometimes headers are not correctly copied into response to the client (some are missing). It happens because sent_header is set prematurely before the actual send happens. The present code in affected cupsdWriteClient() scope looks like code remains from CUPS 1.6.3, where cupsdSendHeader() is called earlier and generates the required headers by itself - the current cupsdSendHeader() sends only the headers which are saved in array fields, so the premature setting of sent_header sometimes causes not having all headers in the response.

With the change, testing via curl gives reliable results all time.