MIAMEX 188: Control WEBCACHE

Added October 2016

xcall MIAMEX, MX_WEBCACHE, 0, status

xcall MIAMEX, MX_WEBCACHE, 1, status

xcall MIAMEX, MX_WEBCACHE, 2, status, url

xcall MIAMEX, MX_WEBCACHE, 3, status, url

xcall MIAMEX, MX_WEBCACHE, 4, status, url, localfile

xcall MIAMEX, MX_WEBCACHE, 5, status {,wildspec}

MX_WEBCACHE provides operations related to A-Shell's web cache feature.

Parameters

opcode  (Num)  [in]

Determines operation as described below.

status  (Signed Num)  [in/out]

Sets or returns options, or returns status codes shown under option 4 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 ASHINC:HOOK.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

WCDF_DLL

&h00000010

download DLLs to bin or webcache

WCFG_ALL

&h000000FE

all flags except WCDF_ENABLE

 

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.

History

2016 October, A-Shell 6.3.1529 and 1531:  WEBCACHE function added to A-Shell. The module includes a basic description, the SET.LIT options for WEBCACHE, new functions WEBRUN.LIT MX_WEBCACHE.SBR, and ? tab(-10,AG_WEBCACHE).