diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2011-03-14 18:45:10 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2011-03-14 18:45:10 +0000 |
commit | f14324a7920bee90b63469ce754e8040933f38e1 (patch) | |
tree | 0077407e46ff904efd4601b99932c9abfd894030 /cups/request.c | |
parent | c8fef167ba1e9d5d87fc77e4e99ca12ba9384cbb (diff) | |
download | cups-f14324a7920bee90b63469ce754e8040933f38e1.tar.gz |
Merge changes from CUPS 1.5svn-r9602.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3046 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/request.c')
-rw-r--r-- | cups/request.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/cups/request.c b/cups/request.c index cf8426fb6..641a51ce0 100644 --- a/cups/request.c +++ b/cups/request.c @@ -22,6 +22,7 @@ * cupsGetResponse() - Get a response to an IPP request. * cupsLastError() - Return the last IPP status code. * cupsLastErrorString() - Return the last IPP status-message. + * _cupsNextDelay() - Return the next retry delay value. * cupsReadResponseData() - Read additional data after the IPP response. * cupsSendRequest() - Send an IPP request. * cupsWriteRequestData() - Write additional data after an IPP request. @@ -414,11 +415,13 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP if (state == IPP_ERROR) { /* - * Delete the response... + * Flush remaining data and delete the response... */ DEBUG_puts("1cupsGetResponse: IPP read error!"); + httpFlush(http); + ippDelete(response); response = NULL; @@ -513,6 +516,36 @@ cupsLastErrorString(void) /* + * '_cupsNextDelay()' - Return the next retry delay value. + * + * This function currently returns the Fibonacci sequence 1 1 2 3 5 8. + * + * Pass 0 for the current delay value to initialize the sequence. + */ + +int /* O - Next delay value */ +_cupsNextDelay(int current, /* I - Current delay value or 0 */ + int *previous) /* IO - Previous delay value */ +{ + int next; /* Next delay value */ + + + if (current > 0) + { + next = (current + *previous) % 12; + *previous = next < current ? 0 : current; + } + else + { + next = 1; + *previous = 0; + } + + return (next); +} + + +/* * 'cupsReadResponseData()' - Read additional data after the IPP response. * * This function is used after cupsGetResponse() to read the PPD or document @@ -658,10 +691,10 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP * "replay" attack... */ - cupsDoAuthentication(http, "POST", resource); + _cupsSetNegotiateAuthString(http); } - else #endif /* HAVE_GSSAPI */ + httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring); DEBUG_printf(("2cupsSendRequest: authstring=\"%s\"", http->authstring)); |