New MIAMEX MX_WEBCACHE (188) function to related to the web cache feature:
The syntax for MX_WEBCACHE is dependent on opcode. For each opcode, add the opcode and what is shown in the "Syntax" column to the statement:
xcall MIAMEX, MX_WEBCACHE,
Opcode |
Syntax |
---|---|
0 |
status |
1 |
status |
2 |
status, url$ |
3 |
status, url$ |
4 |
status, url$, localfile$ |
5 |
status {,wildspec$} |
For example, the syntax for opcode 3 would be:
xcall MIAMEX, MX_WEBCACHE, 3, status, url$
Parameters
opcode (num) [in]
Determines operation (see below).
status (signed int) [in/out]
Sets or returns options, or returns status codes (see below).
url$ (string) [in]
Specifies a web directory for ocodes 2 and 3, and a fully qualified file URL for opcode 4. Currently the only URL schemes supported are http:// and https://. An optional :port may be appended to the end. Examples:
http://www.mysite.com/webrepo
http://www.mysite.com/webrepo/myfile.run:10080
https://www.mysite.com/my web repository
Opcodes
Opcode 0 retrieves the current webcache options in status. Status flags (defined in ashell.def) :
Symbol |
Value |
Description |
---|---|---|
WCDF_ENABLED |
&h00000001 |
web cache enabled (else disabled) |
WCDF_PROG |
&h00000002 |
download/cache programs (RUN,LIT,SBX) |
WCDF_OPENI |
&h00000004 |
download/cache files on open for input |
WCDF_LOOKUP |
&h00000008 |
download/cache any file on LOOKUP or SIZE.SBR |
Opcode 1 sets the webcache options to the value status.
Opcode 2 and 3 retrieve and set webcache url (web directory), respectively. Status will return 0 for success.
Opcode 4 performs a manual download from the specified url$ to the specified localfile$. If the url$ is just a file.ext and the webcache url directory has been previously set, then the two are combined to form the complete source url. If localfile$ is "", the source file.ext is used. If localfile$ does not contain a directory, then the local webcache directory (%MIAME%\webcache) is used. Returned Status will equal the # of bytes downloaded if successful, else an error code:
Status |
Meaning |
---|---|
-1 |
Unsupported URL scheme (e.g. not http:// or https://) |
-2 |
Specified URL does not contain filename (Opcode 2) |
-3 |
URL too long |
-4 |
Unable to connect to host web server |
-5 |
Error sending HTTP GET command to server |
-6 |
Error in local webcache directory\file spec |
-7 |
Response from web server missing header terminator |
-8 |
Response from web server not recognizable |
-9 |
Transmission problem receiving header |
-### |
HTTP response error code (converted to negative) |
Opcode 5 clears the local webcache directory. If the wildspec$ parameter is specified and non-blank, only those files matching the wildspec$ will be cleared; otherwise all of the files in the cache will be cleared. Returned status will equal the number of files removed from the cache.