Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
a4ffcfd4
Commit
a4ffcfd4
authored
21 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
timecond support added
made the Last-Modified (faked) header look correct using GMT always
parent
136670c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/ftp.c
+40
-7
40 additions, 7 deletions
lib/ftp.c
with
40 additions
and
7 deletions
lib/ftp.c
+
40
−
7
View file @
a4ffcfd4
...
...
@@ -1970,11 +1970,37 @@ CURLcode ftp_perform(struct connectdata *conn,
return
result
;
}
/* Requested time of file? */
if
(
data
->
set
.
get_filetime
&&
ftp
->
file
)
{
/* Requested time of file or time-depended transfer? */
if
((
data
->
set
.
get_filetime
||
data
->
set
.
timecondition
)
&&
ftp
->
file
)
{
result
=
ftp_getfiletime
(
conn
,
ftp
->
file
);
if
(
result
)
return
result
;
if
(
data
->
set
.
timecondition
)
{
if
((
data
->
info
.
filetime
>
0
)
&&
(
data
->
set
.
timevalue
>
0
))
{
switch
(
data
->
set
.
timecondition
)
{
case
TIMECOND_IFMODSINCE
:
default:
if
(
data
->
info
.
filetime
<
data
->
set
.
timevalue
)
{
infof
(
data
,
"The requested document is not new enough
\n
"
);
ftp
->
no_transfer
=
TRUE
;
/* mark this to not transfer data */
return
CURLE_OK
;
}
break
;
case
TIMECOND_IFUNMODSINCE
:
if
(
data
->
info
.
filetime
>
data
->
set
.
timevalue
)
{
infof
(
data
,
"The requested document is not old enough
\n
"
);
ftp
->
no_transfer
=
TRUE
;
/* mark this to not transfer data */
return
CURLE_OK
;
}
break
;
}
/* switch */
}
else
{
infof
(
data
,
"Skipping time comparison
\n
"
);
}
}
}
/* If we have selected NOBODY and HEADER, it means that we only want file
...
...
@@ -2017,7 +2043,7 @@ CURLcode ftp_perform(struct connectdata *conn,
tm
=
localtime
((
unsigned
long
*
)
&
data
->
info
.
filetime
);
#endif
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
strftime
(
buf
,
BUFSIZE
-
1
,
"Last-Modified: %a, %d %b %Y %H:%M:%S
%Z
\r\n
"
,
strftime
(
buf
,
BUFSIZE
-
1
,
"Last-Modified: %a, %d %b %Y %H:%M:%S
GMT
\r\n
"
,
tm
);
result
=
Curl_client_write
(
data
,
CLIENTWRITE_BOTH
,
buf
,
0
);
if
(
result
)
...
...
@@ -2063,7 +2089,7 @@ CURLcode ftp_perform(struct connectdata *conn,
CURLcode
Curl_ftp
(
struct
connectdata
*
conn
)
{
CURLcode
retcode
;
bool
connected
;
bool
connected
=
0
;
struct
SessionHandle
*
data
=
conn
->
data
;
struct
FTP
*
ftp
;
...
...
@@ -2116,9 +2142,16 @@ CURLcode Curl_ftp(struct connectdata *conn)
if
(
CURLE_OK
==
retcode
)
{
if
(
connected
)
retcode
=
Curl_ftp_nextconnect
(
conn
);
else
/* since we didn't connect now, we want do_more to get called */
conn
->
bits
.
do_more
=
TRUE
;
else
{
if
(
ftp
->
no_transfer
)
{
/* no data to transfer */
retcode
=
Curl_Transfer
(
conn
,
-
1
,
-
1
,
FALSE
,
NULL
,
-
1
,
NULL
);
}
else
{
/* since we didn't connect now, we want do_more to get called */
conn
->
bits
.
do_more
=
TRUE
;
}
}
}
return
retcode
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment