How to? How do I distinguish missing source file from download error when using HTTP?

May 20, 2008
3,515
4
Elkridge, MD, USA
When I use "copy http://..." how can I distinguish between a data transfer error of an existing source file and the inavailability of the source file? Presumably the exit code of the COPY command provides that information, but I cannot find where its documented (it is not in the COPY command).
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Rex, I presume you meant that any unsuccessful attempt to download a file from a website via HTTP the COPY command exit code will be 2, regardless of the reason for the failure.

Does the HTTP include a method to determine whether or not a downloadable source file exists (analogous to the IF ISFILE status test in TCC)? Or is the only thing a user can do is to try repeatedly and eventually give up? Based on your above answer this question might better be in the Open Forum, but it is a logical outgrowth of the original question...
 

rconn

Administrator
Staff member
May 14, 2008
12,345
150
Does the HTTP include a method to determine whether or not a downloadable source file exists (analogous to the IF ISFILE status test in TCC)? Or is the only thing a user can do is to try repeatedly and eventually give up? Based on your above answer this question might better be in the Open Forum, but it is a logical outgrowth of the original question...

The HTTP protocol doesn't have any means of determining a file's existence. And you can't even rely on an error being returned, because the site could redirect you to another file (or page), and return a completely different result.
 
Nov 13, 2008
255
3
www.thedave.me
The HTTP protocol doesn't have any means of determining a file's existence. And you can't even rely on an error being returned, because the site could redirect you to another file (or page), and return a completely different result.

I'd argue that the HEAD command could be used for this. A 200 means the content exists, a 404 means it does not exist. Other error codes are somewhat more ambiguous.

Perhaps IFF EXISTS http:// could call the HEAD method, return true for 200, false for anything else and set a _httpstatuscode _httpredirect with the actual result so that the user can script how to proceed? Obviously _httpredirect would only return something if we have a 301/302/303/307/308 status code.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Rex:
Considering TheDave's response, possibly you could present this issue to the developers of ipworks? I presume COPY and all other commands accessing the internet utilize them...
 
Similar threads
Thread starter Title Forum Replies Date
Jay Sage Documentation Function @DRIVE Missing in Help Lists Support 0
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
A Key Commands missing? Support 3
L How to? Shebang, nice idea but am I missing something? Support 4
A How to? TCMD Configuration Dialog: 'Smooth Scrolling' Option missing? Support 1
Z Take Command deletes the next letter when I insert a missing letter ? Support 5
Joe Caverly Missing PSHELL in HELP Support 0
JohnQSmith Weird DIR output (missing lines) Support 1
dcantor Documentation SET /T: missing from heading Support 0
M Is STDVCL40.DLL missing or no longer needed? Support 4
vefatica Missing DLL Support 21
E Fixed SHRALIAS doesn't work / SHRALIAS.EXE is missing in v20.11.35 Support 2
vefatica Fixed Help @FUNCTION, missing paragraph Support 8
vefatica Missing post and security error Support 4
Roedy missing English.dll, failed install Support 2
D MSVCP140.dll is missing Support 5
C WAD Logging missing Support 19
H Fixed ... MSVCR120.dll is missing from your system ... Support 2
vefatica Help pages, icon missing Support 8
J The triple mystery of the missing tray icon Support 9
L Full Screen in Office 2013 theme chars missing Support 8
vefatica Build 55: ipworks9.dll missing Support 8
S Documentation "HELP IDE" - missing reference Support 0
vefatica Missing VirtualizerSDK32.dll Support 8
Dan Glynhampton Documentation v15 help: Missing link Support 0
M Missing PERL command-line arguments Support 1
Dan Glynhampton Documentation Bad Link/Missing Page in v15 help Support 0
S Missing thread Support 9
S dir for ftp connection - missing files sometimes Support 1
R CompleteAllFiles missing in option? Support 1
Joe Caverly Sort-of Missing Switch for START in Help Support 7
M How to? Missing closing quote: What am I doing wrong???? Support 7
dcantor SENDMAIL /= missing field Support 4
S DEL on FTP site : complaint about missing DESCRIPT.ION Support 1
Steve Pitts FOLDERMONITOR missing events?? Support 7
M Missing PDir option... Support 5
rnwolf can't start because ipworks8.dll is missing Support 1
thedave Newly created directories missing from TCMD Support 0
dcantor Missing help for @PIDCOMMAND[pid] Support 6
dcantor @TIMEZONE missing from help Support 4
C Rex: Missing email messages from all forums Support 7
L Vista 64 bits missing commands Support 1

Similar threads