timecond: do not add if-modified-since without timecondition
The RTSP code path didn't skip adding the if-modified-since for certain RTSP code paths, even if CURLOPT_TIMECONDITION was set to CURL_TIMECOND_NONE. Also, an unknown non-zero CURLOPT_TIMECONDITION value no longer equals CURL_TIMECOND_IFMODSINCE. Bug: http://stackoverflow.com/questions/33903982/curl-timecond-none-doesnt-work-how-to-remove-if-modified-since-header
This commit is contained in:
parent
5b96b5e79e
commit
cd2b73b3ed
19
lib/http.c
19
lib/http.c
@ -1701,7 +1701,13 @@ CURLcode Curl_add_timecondition(struct SessionHandle *data,
|
|||||||
const struct tm *tm;
|
const struct tm *tm;
|
||||||
char *buf = data->state.buffer;
|
char *buf = data->state.buffer;
|
||||||
struct tm keeptime;
|
struct tm keeptime;
|
||||||
CURLcode result = Curl_gmtime(data->set.timevalue, &keeptime);
|
CURLcode result;
|
||||||
|
|
||||||
|
if(data->set.timecondition == CURL_TIMECOND_NONE)
|
||||||
|
/* no condition was asked for */
|
||||||
|
return CURLE_OK;
|
||||||
|
|
||||||
|
result = Curl_gmtime(data->set.timevalue, &keeptime);
|
||||||
if(result) {
|
if(result) {
|
||||||
failf(data, "Invalid TIMEVALUE");
|
failf(data, "Invalid TIMEVALUE");
|
||||||
return result;
|
return result;
|
||||||
@ -1727,8 +1733,9 @@ CURLcode Curl_add_timecondition(struct SessionHandle *data,
|
|||||||
tm->tm_sec);
|
tm->tm_sec);
|
||||||
|
|
||||||
switch(data->set.timecondition) {
|
switch(data->set.timecondition) {
|
||||||
case CURL_TIMECOND_IFMODSINCE:
|
|
||||||
default:
|
default:
|
||||||
|
break;
|
||||||
|
case CURL_TIMECOND_IFMODSINCE:
|
||||||
result = Curl_add_bufferf(req_buffer,
|
result = Curl_add_bufferf(req_buffer,
|
||||||
"If-Modified-Since: %s\r\n", buf);
|
"If-Modified-Since: %s\r\n", buf);
|
||||||
break;
|
break;
|
||||||
@ -2394,11 +2401,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(data->set.timecondition) {
|
result = Curl_add_timecondition(data, req_buffer);
|
||||||
result = Curl_add_timecondition(data, req_buffer);
|
if(result)
|
||||||
if(result)
|
return result;
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = Curl_add_custom_headers(conn, FALSE, req_buffer);
|
result = Curl_add_custom_headers(conn, FALSE, req_buffer);
|
||||||
if(result)
|
if(result)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user