Lines Matching full:http
40 cupsDoFileRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */ in cupsDoFileRequest() argument
42 const char *resource, /* I - HTTP resource for POST */ in cupsDoFileRequest()
49 …DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", filename=\"%s\")", (voi… in cupsDoFileRequest()
70 response = cupsDoIORequest(http, request, resource, infile, -1); in cupsDoFileRequest()
96 cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */ in cupsDoIORequest() argument
98 const char *resource, /* I - HTTP resource for POST */ in cupsDoIORequest()
104 http_status_t status; /* Status of HTTP request */ in cupsDoIORequest()
110 …DEBUG_printf(("cupsDoIORequest(http=%p, request=%p(%s), resource=\"%s\", infile=%d, outfile=%d)", … in cupsDoIORequest()
129 if (!http && (http = _cupsConnect()) == NULL) in cupsDoIORequest()
186 if (http->authstring && !strncmp(http->authstring, "Local ", 6)) in cupsDoIORequest()
187 httpSetAuthString(http, NULL, NULL); in cupsDoIORequest()
201 status = cupsSendRequest(http, request, resource, length); in cupsDoIORequest()
220 if ((status = cupsWriteRequestData(http, buffer, (size_t)bytes)) in cupsDoIORequest()
232 response = cupsGetResponse(http, resource); in cupsDoIORequest()
233 status = httpGetStatus(http); in cupsDoIORequest()
252 while ((bytes = httpRead2(http, buffer, sizeof(buffer))) > 0) in cupsDoIORequest()
257 if (http->state != HTTP_STATE_WAITING) in cupsDoIORequest()
263 httpFlush(http); in cupsDoIORequest()
285 cupsDoRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */ in cupsDoRequest() argument
287 const char *resource) /* I - HTTP resource for POST */ in cupsDoRequest()
289 …DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")", (void *)http, (void *)req… in cupsDoRequest()
291 return (cupsDoIORequest(http, request, resource, -1, -1)); in cupsDoRequest()
306 ipp_t * /* O - Response or @code NULL@ on HTTP error */
307 cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */ in cupsGetResponse() argument
308 const char *resource) /* I - HTTP resource for POST */ in cupsGetResponse()
310 http_status_t status; /* HTTP status */ in cupsGetResponse()
315 DEBUG_printf(("cupsGetResponse(http=%p, resource=\"%s\")", (void *)http, resource)); in cupsGetResponse()
316 DEBUG_printf(("1cupsGetResponse: http->state=%d", http ? http->state : HTTP_STATE_ERROR)); in cupsGetResponse()
322 if (!http) in cupsGetResponse()
327 if ((http = cg->http) == NULL) in cupsGetResponse()
335 if (http->state != HTTP_STATE_POST_RECV && http->state != HTTP_STATE_POST_SEND) in cupsGetResponse()
346 if (http->data_encoding == HTTP_ENCODING_CHUNKED) in cupsGetResponse()
354 if (httpWrite2(http, "", 0) < 0) in cupsGetResponse()
362 DEBUG_printf(("2cupsGetResponse: Update loop, http->status=%d...", in cupsGetResponse()
363 http->status)); in cupsGetResponse()
367 status = httpUpdate(http); in cupsGetResponse()
381 while ((state = ippRead(http, response)) != IPP_STATE_DATA) in cupsGetResponse()
393 httpFlush(http); in cupsGetResponse()
398 http->status = status = HTTP_STATUS_ERROR; in cupsGetResponse()
399 http->error = EINVAL; in cupsGetResponse()
408 httpFlush(http); in cupsGetResponse()
422 if (!cupsDoAuthentication(http, "POST", resource)) in cupsGetResponse()
423 httpReconnect2(http, 30000, NULL); in cupsGetResponse()
425 http->status = status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED; in cupsGetResponse()
437 if (!httpReconnect2(http, 30000, NULL)) in cupsGetResponse()
438 httpEncryption(http, HTTP_ENCRYPTION_REQUIRED); in cupsGetResponse()
531 http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */ in cupsReadResponseData() argument
539 …DEBUG_printf(("cupsReadResponseData(http=%p, buffer=%p, length=" CUPS_LLFMT ")", (void *)http, (vo… in cupsReadResponseData()
541 if (!http) in cupsReadResponseData()
546 if ((http = cg->http) == NULL) in cupsReadResponseData()
554 * Then read from the HTTP connection... in cupsReadResponseData()
557 return (httpRead2(http, buffer, length)); in cupsReadResponseData()
570 * Returns the initial HTTP status code, which will be @code HTTP_STATUS_CONTINUE@
579 http_status_t /* O - Initial HTTP status */
580 cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */ in cupsSendRequest() argument
585 http_status_t status; /* Status of HTTP request */ in cupsSendRequest()
593 …DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", length=" CUPS_LLFMT ")", … in cupsSendRequest()
610 if (!http && (http = _cupsConnect()) == NULL) in cupsSendRequest()
617 if (http->state == HTTP_STATE_GET_SEND || in cupsSendRequest()
618 http->state == HTTP_STATE_POST_SEND) in cupsSendRequest()
621 httpFlush(http); in cupsSendRequest()
623 else if (http->state != HTTP_STATE_WAITING) in cupsSendRequest()
625 DEBUG_printf(("1cupsSendRequest: Unknown HTTP state (%d), " in cupsSendRequest()
626 "reconnecting.", http->state)); in cupsSendRequest()
627 if (httpReconnect2(http, 30000, NULL)) in cupsSendRequest()
639 !httpAddrLocalhost(http->hostaddr) && !http->tls && in cupsSendRequest()
640 httpEncryption(http, HTTP_ENCRYPTION_REQUIRED)) in cupsSendRequest()
651 if (!_cups_strcasecmp(httpGetField(http, HTTP_FIELD_CONNECTION), "close")) in cupsSendRequest()
654 httpClearFields(http); in cupsSendRequest()
655 if (httpReconnect2(http, 30000, NULL)) in cupsSendRequest()
673 * Setup the HTTP variables needed... in cupsSendRequest()
676 httpClearFields(http); in cupsSendRequest()
677 httpSetExpect(http, expect); in cupsSendRequest()
678 httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp"); in cupsSendRequest()
679 httpSetField(http, HTTP_FIELD_DATE, httpGetDateString2(time(NULL), date, (int)sizeof(date))); in cupsSendRequest()
680 httpSetLength(http, length); in cupsSendRequest()
682 digest = http->authstring && !strncmp(http->authstring, "Digest ", 7); in cupsSendRequest()
690 _httpSetDigestAuthString(http, http->nextnonce, "POST", resource); in cupsSendRequest()
694 if (http->authstring && !strncmp(http->authstring, "Negotiate", 9)) in cupsSendRequest()
701 _cupsSetNegotiateAuthString(http, "POST", resource); in cupsSendRequest()
705 httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring); in cupsSendRequest()
707 DEBUG_printf(("2cupsSendRequest: authstring=\"%s\"", http->authstring)); in cupsSendRequest()
713 DEBUG_puts("2cupsSendRequest: Sending HTTP POST..."); in cupsSendRequest()
715 if (httpPost(http, resource)) in cupsSendRequest()
718 if (httpReconnect2(http, 30000, NULL)) in cupsSendRequest()
737 while ((state = ippWrite(http, request)) != IPP_STATE_DATA) in cupsSendRequest()
739 if (httpCheck(http)) in cupsSendRequest()
743 _httpUpdate(http, &status); in cupsSendRequest()
754 * We weren't able to send the IPP request. But did we already get a HTTP in cupsSendRequest()
766 http->status = HTTP_STATUS_ERROR; in cupsSendRequest()
767 http->state = HTTP_STATE_WAITING; in cupsSendRequest()
783 if (httpWait(http, 1000)) in cupsSendRequest()
784 _httpUpdate(http, &status); in cupsSendRequest()
786 else if (httpCheck(http)) in cupsSendRequest()
787 _httpUpdate(http, &status); in cupsSendRequest()
793 * Process the current HTTP status... in cupsSendRequest()
804 temp_status = httpUpdate(http); in cupsSendRequest()
807 http->state == HTTP_STATE_POST_RECV); in cupsSendRequest()
809 httpFlush(http); in cupsSendRequest()
821 if (cupsDoAuthentication(http, "POST", resource)) in cupsSendRequest()
829 if (httpReconnect2(http, 30000, NULL)) in cupsSendRequest()
846 if (httpReconnect2(http, 30000, NULL)) in cupsSendRequest()
853 if (httpEncryption(http, HTTP_ENCRYPTION_REQUIRED)) in cupsSendRequest()
871 if (httpReconnect2(http, 30000, NULL)) in cupsSendRequest()
898 http_status_t /* O - @code HTTP_STATUS_CONTINUE@ if OK or HTTP status on error */
900 http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */ in cupsWriteRequestData() argument
911 …DEBUG_printf(("cupsWriteRequestData(http=%p, buffer=%p, length=" CUPS_LLFMT ")", (void *)http, (vo… in cupsWriteRequestData()
913 if (!http) in cupsWriteRequestData()
918 if ((http = cg->http) == NULL) in cupsWriteRequestData()
927 * Then write to the HTTP connection... in cupsWriteRequestData()
930 wused = http->wused; in cupsWriteRequestData()
932 if (httpWrite2(http, buffer, length) < 0) in cupsWriteRequestData()
935 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(http->error), 0); in cupsWriteRequestData()
944 http->wused < wused || in cupsWriteRequestData()
945 (wused > 0 && (size_t)http->wused == length)) in cupsWriteRequestData()
951 if (_httpWait(http, 0, 1)) in cupsWriteRequestData()
955 _httpUpdate(http, &status); in cupsWriteRequestData()
962 status = httpUpdate(http); in cupsWriteRequestData()
964 while (status != HTTP_STATUS_ERROR && http->state == HTTP_STATE_POST_RECV); in cupsWriteRequestData()
966 httpFlush(http); in cupsWriteRequestData()
983 http_t * /* O - HTTP connection */
993 if (cg->http) in _cupsConnect()
1001 if (strcmp(cg->http->hostname, cg->server) || in _cupsConnect()
1003 …(httpAddrFamily(cg->http->hostaddr) != AF_LOCAL && cg->ipp_port != httpAddrPort(cg->http->hostaddr… in _cupsConnect()
1005 cg->ipp_port != httpAddrPort(cg->http->hostaddr) || in _cupsConnect()
1007 (cg->http->encryption != cg->encryption && in _cupsConnect()
1008 cg->http->encryption == HTTP_ENCRYPTION_NEVER)) in _cupsConnect()
1014 httpClose(cg->http); in _cupsConnect()
1015 cg->http = NULL; in _cupsConnect()
1027 if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK)) == 0 || in _cupsConnect()
1030 if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT)) == 0 || in _cupsConnect()
1038 httpClose(cg->http); in _cupsConnect()
1039 cg->http = NULL; in _cupsConnect()
1048 if (!cg->http) in _cupsConnect()
1050 if ((cg->http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC, in _cupsConnect()
1065 return (cg->http); in _cupsConnect()
1121 * '_cupsSetHTTPError()' - Set the last error using the HTTP status.
1125 _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */ in _cupsSetHTTPError()
1174 DEBUG_printf(("4_cupsSetHTTPError: HTTP error %d mapped to " in _cupsSetHTTPError()