Skip to content

cupsDoRequest usually fails when reusing the http_t* connection between the printer. #963

Closed Answered by michaelrsweet
xiaowen581 asked this question in Q&A
Discussion options

You must be logged in to vote

In my app, I can perform a retry after a cupsDoRequest failure, but I think the httpReconnect2 logic in cupsSendRequest and the keep_alive in _http_s seems not to be well thought out.

A printer that closes the HTTP connection after processing one IPP request successfully and doesn't include the "Connection: close" header is not conformant - what printer are you talking to?

The code to send the HTTP POST request does try to reconnect if it detects the connection is closed but due to the nature of the BSD sockets API it is possible for that failure to not be detected until after the request is sent. Your observation that debug logging changes the behavior confirms this issue...

Since we d…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by xiaowen581
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants