1
#! /bin/sh /usr/share/dpatch/dpatch-run
3
## DP: Fix client loop for SSL connections.
5
--- a/scheduler/client.c (revision 7820)
6
+++ b/scheduler/client.c (working copy)
8
* cupsdUpdateCGI() - Read status messages from CGI scripts and programs.
9
* cupsdWriteClient() - Write data to a client as needed.
10
* check_if_modified() - Decode an "If-Modified-Since" line.
11
+ * data_ready() - Check whether data is available from a client.
12
* encrypt_client() - Enable encryption for the client...
13
* get_cdsa_certificate() - Convert a keychain name into the CFArrayRef
14
* required by SSLSetCertificate.
17
static int check_if_modified(cupsd_client_t *con,
18
struct stat *filestats);
19
+static int data_ready(cupsd_client_t *con);
21
static int encrypt_client(cupsd_client_t *con);
26
while ((status = httpUpdate(HTTP(con))) == HTTP_CONTINUE)
27
- if (con->http.used == 0 ||
28
- !memchr(con->http.buffer, '\n', con->http.used))
29
+ if (!data_ready(con))
32
if (status != HTTP_OK && status != HTTP_CONTINUE)
37
- while (con->http.state == HTTP_PUT_RECV && con->http.used > 0);
38
+ while (con->http.state == HTTP_PUT_RECV && data_ready(con));
40
if (con->http.state == HTTP_WAITING)
46
- while (con->http.state == HTTP_POST_RECV && con->http.used > 0);
47
+ while (con->http.state == HTTP_POST_RECV && data_ready(con));
49
if (con->http.state == HTTP_POST_SEND)
51
@@ -2914,7 +2915,39 @@
56
+ * 'data_ready()' - Check whether data is available from a client.
59
+static int /* O - 1 if data is ready, 0 otherwise */
60
+data_ready(cupsd_client_t *con) /* I - Client */
62
+ if (con->http.used > 0)
65
+ else if (con->http.tls)
68
+ if (SSL_pending((SSL *)(con->http.tls)))
70
+# elif defined(HAVE_GNUTLS)
71
+ if (gnutls_record_check_pending(((http_tls_t *)(con->http.tls))->session))
73
+# elif defined(HAVE_CDSASSL)
74
+ size_t bytes; /* Bytes that are available */
76
+ if (!SSLGetBufferedReadSize(((http_tls_t *)(con->http.tls))->session,
77
+ &bytes) && bytes > 0)
79
+# endif /* HAVE_LIBSSL */
81
+#endif /* HAVE_SSL */
89
* 'encrypt_client()' - Enable encryption for the client...