Lines Matching refs:http
66 #include "http.h"
109 * HTTP handler interface.
112 "HTTP", /* scheme */
160 /* allocate the HTTP-specific struct for the Curl_easy, only to survive
162 struct HTTP *http;
166 http = calloc(1, sizeof(struct HTTP));
167 if(!http)
170 Curl_mime_initpart(&http->form, conn->data);
171 data->req.protop = http;
183 * if proxy headers are not available, then it will lookup into http header
210 * given HTTP header line and return a strdupped copy. Returns NULL in
263 * for HTTP Basic authentication.
319 * for HTTP Bearer authentication.
403 struct HTTP *http = data->req.protop;
407 if(!http)
428 /* HTTP CONNECT in progress: there is no body */
444 expectsend = http->postsize;
514 streamclose(conn, "Mid-auth HTTP and much data left to send");
529 * Curl_http_auth_act() gets called when all HTTP headers have been received
561 infof(data, "Forcing HTTP/1.1 for NTLM");
562 HTTP/1.1 connection");
984 * http_should_fail() determines whether an HTTP response has gotten us
1069 struct HTTP *http = conn->data->req.protop;
1072 if(!http->postsize)
1076 /* make sure that a HTTP request is never sent away chunked! */
1077 conn->data->req.forbidchunk = (http->sending == HTTPSEND_REQUEST)?TRUE:FALSE;
1079 if(http->postsize <= (curl_off_t)fullsize) {
1080 memcpy(buffer, http->postdata, (size_t)http->postsize);
1081 fullsize = (size_t)http->postsize;
1083 if(http->backup.postsize) {
1085 http->postdata = http->backup.postdata;
1086 http->postsize = http->backup.postsize;
1087 conn->data->state.fread_func = http->backup.fread_func;
1088 conn->data->state.in = http->backup.fread_in;
1090 http->sending++; /* move one step up */
1092 http->backup.postsize = 0;
1095 http->postsize = 0;
1100 memcpy(buffer, http->postdata, fullsize);
1101 http->postdata += fullsize;
1102 http->postsize -= fullsize;
1152 struct HTTP *http = data->req.protop;
1238 if(http) {
1254 http->backup.fread_func = data->state.fread_func;
1255 http->backup.fread_in = data->state.in;
1256 http->backup.postdata = http->postdata;
1257 http->backup.postsize = http->postsize;
1262 http->postdata = ptr;
1263 http->postsize = (curl_off_t)size;
1265 http->send_buffer = in;
1266 http->sending = HTTPSEND_REQUEST;
1270 http->sending = HTTPSEND_BODY;
1433 * Curl_http_connect() performs HTTP stuff to do at connect-time, called from
1442 connkeep(conn, "HTTP default");
1558 * Curl_http_done() gets called after a single HTTP request has been
1566 struct HTTP *http = data->req.protop;
1579 if(!http)
1582 if(http->send_buffer) {
1583 Curl_add_buffer_free(&http->send_buffer);
1588 Curl_mime_cleanpart(&http->form);
1601 read from the HTTP server (that counts), this can't be right so we
1611 * Determine if we should use HTTP 1.1 (OR BETTER) for this request. Reasons
1614 * - if the user specifically requested HTTP 1.0
1655 /* if not doing HTTP 1.0 or version 2, or disabled explicitly, we add an
1839 /* HTTP/2 doesn't support chunked requests */
1902 * GMT as RFC2616 defines: "All HTTP date/time stamps MUST be
1904 * purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal
1926 * Curl_http() gets called from the generic multi_do() function when a HTTP
1928 * HTTP request.
1934 struct HTTP *http;
1961 conn->httpversion = 20; /* we know we're on HTTP/2 now */
1968 /* continue with HTTP/1.1 when explicitly requested */
1971 /* Check if user wants to use HTTP/2 with clear TCP*/
1975 DEBUGF(infof(data, "HTTP/2 over clean TCP\n"));
1993 http = data->req.protop;
1994 DEBUGASSERT(http);
2137 http->sendit = &data->set.mimepost;
2141 Curl_mime_cleanpart(&http->form);
2142 result = Curl_getformdata(data, &http->form, data->set.httppost,
2146 http->sendit = &http->form;
2149 http->sendit = NULL;
2152 if(http->sendit) {
2156 http->sendit->flags |= MIME_BODY_ONLY;
2163 else if(http->sendit->kind == MIMEKIND_MULTIPART)
2166 curl_mime_headers(http->sendit, data->set.headers, 0);
2167 result = Curl_mime_prepare_headers(http->sendit, cthdr,
2169 curl_mime_headers(http->sendit, NULL, 0);
2171 result = Curl_mime_rewind(http->sendit);
2174 httphttp->sendit);
2186 http->postsize < 0) ||
2192 /* HTTP, upload, unknown file size and not HTTP 1.0 */
2196 failf(data, "Chunky upload is not supported by HTTP 1.0");
2266 /* if(HTTPS on port 443) OR (HTTP on port 80) then don't include
2312 if(strcasecompare("http", data->state.up.scheme)) {
2313 /* when getting HTTP, we don't want the userinfo the URL */
2371 http->p_accept = Curl_checkheaders(conn, "Accept")?NULL:"Accept: */*\r\n";
2376 * Resuming upload in HTTP means that we PUT or POST and that we have
2380 * file size before we continue this venture in the dark lands of HTTP.
2538 " HTTP/%s\r\n" /* HTTP version */
2563 http->p_accept?http->p_accept:"",
2589 /* append HTTP2 upgrade magic stuff to the HTTP request if it isn't done
2657 http->postdata = NULL; /* nothing to post at this point */
2728 data->state.infilesize = postsize = http->postsize;
2748 for(hdr = http->sendit->curlheaders; hdr; hdr = hdr->next) {
2782 data->state.in = (void *) http->sendit;
2783 http->sending = HTTPSEND_BODY;
2857 then append the post data to the HTTP request header. This limit
2896 http->postsize = postsize;
2897 http->postdata = data->set.postfields;
2899 http->sending = HTTPSEND_BODY;
2905 Curl_pgrsSetUploadSize(data, http->postsize);
2935 http->postdata = (char *)&http->postdata;
2936 http->postsize = postsize;
2945 failf(data, "Failed sending HTTP POST request");
2948 http->postdata?FIRSTSOCKET:-1);
2961 failf(data, "Failed sending HTTP request");
2963 /* HTTP GET/HEAD download: */
2965 http->postdata?FIRSTSOCKET:-1);
3047 if((rc != STATUS_DONE) && (checkprefixmax("HTTP/", s, len)))
3149 /* make sure that data->req.p points to the HTTP status line */
3150 if(!strncmp(beg, "HTTP", 4)) {
3152 /* skip to HTTP status code */
3160 /* try to find LF (workaround for non-compliant HTTP servers) */
3177 /* fall-back to printing the HTTP status code only */
3182 * Read any HTTP header lines from the server and pass them to the client app.
3221 streamclose(conn, "bad HTTP: No end-of-message indicator");
3223 failf(data, "Received HTTP/0.9 when not allowed\n");
3257 streamclose(conn, "bad HTTP: No end-of-message indicator");
3260 failf(data, "Received HTTP/0.9 when not allowed\n");
3305 * We have made a HTTP PUT or POST and this is 1.1-lingo
3324 /* Switching to HTTP/2 */
3328 /* we'll get more headers (HTTP/2 response) */
3359 /* On HTTP 1.1, when connection is not to get closed, but no
3366 streamclose(conn, "HTTP: No end-of-message indicator");
3378 infof(data, "Connection closure while negotiating auth (HTTP 1.0?)\n");
3388 infof(data, "Connection closure while negotiating auth (HTTP 1.0?)\n");
3466 infof(data, "HTTP error before end of send, keep sending\n");
3473 infof(data, "HTTP error before end of send, stop sending\n");
3542 nothing and can safely return ok now! But for HTTP/2, we'd
3586 char scratch[SCRATCHSIZE + 1]; /* "HTTP/major.minor 123" */
3608 * The response code is always a three-digit number in HTTP as the spec
3614 " HTTP/%1d.%1d%c%3d",
3621 1 == sscanf(HEADER1, " HTTP/2 %d", &k->httpcode)) {
3633 infof(data, "Lying server, not serving HTTP/2\n");
3638 NCSA 1.5.x returns this crap when asked for HTTP/1.1
3640 nc = sscanf(HEADER1, " HTTP %3d", &k->httpcode);
3655 failf(data, "Unsupported HTTP version in response\n");
3669 conn->httpversion = 11; /* For us, RTSP acts like HTTP 1.1 */
3709 /* Default action for HTTP/1.0 must be to close, unless
3712 infof(data, "HTTP 1.0, assume close after body\n");
3713 connclose(conn, "HTTP/1.0 close after body");
3717 DEBUGF(infof(data, "HTTP/2 found, allow multiplexing\n"));
3719 /* HTTP/2 cannot blacklist multiplexing since it is a core
3725 /* If HTTP version is >= 1.1 and connection is persistent
3728 "HTTP 1.1 or later with persistent connection, "
3801 /* negative or just rubbish - bad HTTP */
3837 * When a HTTP/1.0 reply comes when using a proxy, the
3843 infof(data, "HTTP/1.0 proxy connection set to keep alive!\n");
3850 * We get a HTTP/1.1 response from a proxy and it says it'll
3854 infof(data, "HTTP/1.1 proxy connection set close!\n");
3859 * A HTTP/1.0 reply with the 'Connection: keep-alive' line
3865 infof(data, "HTTP/1.0 connection set to keep alive!\n");
3870 * "Connection: close" is HTTP/1.1 language and means that