18
18
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
* KIND, either express or implied.
21
* $Id: http.c,v 1.272 2005/05/11 09:52:59 bagder Exp $
21
* $Id: http.c,v 1.275 2005/10/20 20:07:33 bagder Exp $
22
22
***************************************************************************/
621
622
#ifndef CURL_DISABLE_CRYPTO_AUTH
622
623
if(checkprefix("Digest", start)) {
624
*availp |= CURLAUTH_DIGEST;
625
authp->avail |= CURLAUTH_DIGEST;
627
/* We call this function on input Digest headers even if Digest
628
* authentication isn't activated yet, as we need to store the
629
* incoming data from this header in case we are gonna use Digest. */
630
dig = Curl_input_digest(conn, (bool)(httpcode == 407), start);
632
if(CURLDIGEST_FINE != dig) {
633
infof(data, "Authentication problem. Ignoring this.\n");
634
data->state.authproblem = TRUE;
624
if((authp->avail & CURLAUTH_DIGEST) != 0) {
625
infof(data, "Ignoring duplicate digest auth header.\n");
629
*availp |= CURLAUTH_DIGEST;
630
authp->avail |= CURLAUTH_DIGEST;
632
/* We call this function on input Digest headers even if Digest
633
* authentication isn't activated yet, as we need to store the
634
* incoming data from this header in case we are gonna use Digest. */
635
dig = Curl_input_digest(conn, (bool)(httpcode == 407), start);
637
if(CURLDIGEST_FINE != dig) {
638
infof(data, "Authentication problem. Ignoring this.\n");
639
data->state.authproblem = TRUE;
1056
* ConnectHTTPProxyTunnel() requires that we're connected to a HTTP
1057
* proxy. This function will issue the necessary commands to get a seamless
1058
* tunnel through this proxy. After that, the socket can be used just as a
1062
* Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This
1063
* function will issue the necessary commands to get a seamless tunnel through
1064
* this proxy. After that, the socket can be used just as a normal socket.
1061
1066
* This badly needs to be rewritten. CONNECT should be sent and dealt with
1062
1067
* like any ordinary HTTP request, and not specially crafted like this. This
1064
1069
* much work to do at the moment.
1067
CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
1072
CURLcode Curl_proxyCONNECT(struct connectdata *conn,
1072
1077
int subversion=0;
1073
1078
struct SessionHandle *data=conn->data;
1217
1223
nread += gotbytes;
1226
/* This means we are currently ignoring a response-body, so we
1227
simply count down our counter and make sure to break out of the
1228
loop when we're done! */
1218
1236
for(i = 0; i < gotbytes; ptr++, i++) {
1219
1237
perline++; /* amount of bytes in this line so far */
1220
1238
if(*ptr=='\n') {
1242
1260
if(('\r' == line_start[0]) ||
1243
1261
('\n' == line_start[0])) {
1244
1262
/* end of response-headers from the proxy */
1263
if(cl && (407 == k->httpcode) && !data->state.authproblem) {
1264
/* If we get a 407 response code with content length when we
1265
* have no auth problem, we must ignore the whole
1268
infof(data, "Ignore %" FORMAT_OFF_T
1269
" bytes of response-body\n", cl);
1270
cl -= (gotbytes - i);/* remove the remaining chunk of what
1273
/* if the whole thing was already read, we are done! */
1246
1278
break; /* breaks out of for-loop, not switch() */
1292
else if(checkprefix("Content-Length:", line_start)) {
1293
cl = curlx_strtoofft(line_start + strlen("Content-Length:"),
1260
1296
else if(2 == sscanf(line_start, "HTTP/1.%d %d",
1262
1298
&k->httpcode)) {
1323
1359
if(conn->bits.tunnel_proxy) {
1325
1361
/* either SSL over proxy, or explicitly asked for */
1326
result = Curl_ConnectHTTPProxyTunnel(conn, FIRSTSOCKET,
1362
result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
1329
1365
if(CURLE_OK != result)