5
5
* | (__| |_| | _ <| |___
6
6
* \___|\___/|_| \_\_____|
8
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
8
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
10
10
* This software is licensed as described in the file COPYING, which
11
11
* you should have received as part of this distribution. The terms
359
* Check to see if CURLOPT_TIMECONDITION was met by comparing the time of the
360
* remote document with the time provided by CURLOPT_TIMEVAL
362
bool Curl_meets_timecondition(struct SessionHandle *data, long timeofdoc)
364
if((timeofdoc == 0) || (data->set.timevalue == 0))
367
switch(data->set.timecondition) {
368
case CURL_TIMECOND_IFMODSINCE:
370
if(timeofdoc <= data->set.timevalue) {
372
"The requested document is not new enough\n");
373
data->info.timecond = TRUE;
377
case CURL_TIMECOND_IFUNMODSINCE:
378
if(timeofdoc >= data->set.timevalue) {
380
"The requested document is not old enough\n");
381
data->info.timecond = TRUE;
360
391
* Go ahead and do a read if we have a readable socket or if
518
549
requested. This seems to be what chapter 13.3.4 of
519
550
RFC 2616 defines to be the correct action for a
520
551
HTTP/1.1 client */
521
if((k->timeofdoc > 0) && (data->set.timevalue > 0)) {
522
switch(data->set.timecondition) {
523
case CURL_TIMECOND_IFMODSINCE:
525
if(k->timeofdoc < data->set.timevalue) {
527
"The requested document is not new enough\n");
529
data->info.timecond = TRUE;
533
case CURL_TIMECOND_IFUNMODSINCE:
534
if(k->timeofdoc > data->set.timevalue) {
536
"The requested document is not old enough\n");
538
data->info.timecond = TRUE;
543
} /* two valid time strings */
553
if(!Curl_meets_timecondition(data, k->timeofdoc)) {
544
557
} /* we have a time condition */
546
559
} /* this is HTTP */
1066
1079
if(k->keepon) {
1067
if(0 > Curl_timeleft(conn, &k->now, FALSE)) {
1080
if(0 > Curl_timeleft(data, &k->now, FALSE)) {
1068
1081
if(k->size != -1) {
1069
1082
failf(data, "Operation timed out after %ld milliseconds with %"
1070
1083
FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes received",
1347
1360
to work with, skip the timeout */
1348
1361
timeout_ms = 0;
1350
totmp = Curl_timeleft(conn, &k->now, FALSE);
1363
totmp = Curl_timeleft(data, &k->now, FALSE);
1352
1365
return CURLE_OPERATION_TIMEDOUT;
1353
1366
else if(!totmp)
1393
1406
if(!hostp->data)
1395
1408
if(hostp->data[0] == '-') {
1396
/* mark an entry for removal */
1409
/* TODO: mark an entry for removal */
1398
1411
else if(3 == sscanf(hostp->data, "%255[^:]:%d:%255s", hostname, &port,
1461
1479
/* If there is a list of host pairs to deal with */
1462
1480
if(data->change.resolve)
1463
loadhostpairs(data);
1481
res = loadhostpairs(data);
1465
/* Allow data->set.use_port to set which port to use. This needs to be
1466
* disabled for example when we follow Location: headers to URLs using
1467
* different ports! */
1468
data->state.allow_port = TRUE;
1484
/* Allow data->set.use_port to set which port to use. This needs to be
1485
* disabled for example when we follow Location: headers to URLs using
1486
* different ports! */
1487
data->state.allow_port = TRUE;
1470
1489
#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(HAVE_MSG_NOSIGNAL)
1471
/*************************************************************
1472
* Tell signal handler to ignore SIGPIPE
1473
*************************************************************/
1474
if(!data->set.no_signal)
1475
data->state.prev_signal = signal(SIGPIPE, SIG_IGN);
1490
/*************************************************************
1491
* Tell signal handler to ignore SIGPIPE
1492
*************************************************************/
1493
if(!data->set.no_signal)
1494
data->state.prev_signal = signal(SIGPIPE, SIG_IGN);
1478
Curl_initinfo(data); /* reset session-specific information "variables" */
1479
Curl_pgrsStartNow(data);
1481
if(data->set.timeout)
1482
Curl_expire(data, data->set.timeout);
1484
if(data->set.connecttimeout)
1485
Curl_expire(data, data->set.connecttimeout);
1497
Curl_initinfo(data); /* reset session-specific information "variables" */
1498
Curl_pgrsStartNow(data);
1500
if(data->set.timeout)
1501
Curl_expire(data, data->set.timeout);
1503
if(data->set.connecttimeout)
1504
Curl_expire(data, data->set.connecttimeout);