@@ -494,39 +494,45 @@ _libdispatch/dinfermodel.c_ via the API in _include/ncmodel.h_.
494494The term _model_ is used here to include (at least) the following
495495information (see the structure type _NCmodel_ in _include/ncmodel.h_).
496496
497- 1. format -- this is an NC_FORMAT_XXX value defining the file format
498- as seen by the user program.
499- 2. version -- the specific version of the format.
500- 3. iosp -- this is and NC_IOSP_XXX value describing internal protocols to use.
501- 4. impl -- this is an NC_FORMATX_XXX value defining, in effect, the
497+ 1. impl -- this is an NC_FORMATX_XXX value defining, in effect, the
502498 dispatch table to use.
503499
504- For example, if the format was NC_FORMAT_CLASSIC, then the client
505- will see the netcdf-3 data model, as modified by the version. If the
506- version was 5, for example, then that indicates the file format
507- is actually NC_FORMAT_64BIT_DATA, which is a variant of the netcdf-3
508- format.
509-
510- The _iosp_ provides information about how the protocol the
511- dispatch table will use to access the actual dataset. If the iosp
512- is NC_IOSP_S3RAW, then it indicates that the dispatcher, NC_FORMATX_NC3,
513- for example, will access the dataset using the Amazon S3 REST API.
514-
515500The construction of the model is primarily carried out by the function
516- _NC_infermodel()_. It is given the following parameters:
501+ _NC_infermodel()_ (in _libdispatch/dinfermodel.c_).
502+ It is given the following parameters:
5175031. path -- (IN) absolute file path or URL
518- 2. omodep -- (IN/OUT) the set of mode flags given to _NC_open_ or _NC_create_.
504+ 2. modep -- (IN/OUT) the set of mode flags given to _NC_open_ or _NC_create_.
5195053. iscreate -- (IN) distinguish open from create.
5205064. useparallel -- (IN) indicate if parallel IO can be used.
5215075. params -- (IN/OUT) arbitrary data dependent on the mode and path.
522- 6. model -- (IN/OUT) place to store inferred model information (e.g. format
523- or version).
524- 7. newpathp -- (OUT) sometimes, it is necessary to rewrite the path.
508+ 6. model -- (IN/OUT) place to store inferred model.
509+ 7. newpathp -- (OUT) the canonical rewrite of the path argument.
525510
526511As a rule, these values are used in the this order to infer the model.
5275121. file contents -- highest precedence
528- 2. url (if it is one) -- using the protocol and fragment arguments
513+ 2. url (if it is one) -- using the "mode=" key in the fragment (see below).
5295143. mode flags
5305154. default format -- lowest precedence
531516
517+ If the path appears to be a URL, then it is parsed.
518+ Information is extracted from the URL, and specifically,
519+ the fragment key "mode=" is the critical element.
520+ The URL will be rewritten to a canonical form with the following
521+ changes.
522+ 1. The fragment part ("#..." at the end) is parsed and the "mode=" key
523+ is extracted and its value is converted to a list of tags.
524+ 2. If the leading protocol is not http/https, then the protocol is added
525+ to the mode list. That protocol is then replaced with either http or https.
526+ 3. Certain singleton values inb the fragment are extracted and removed
527+ and added to the mode list. Consider, for example, "http://....#dap4".
528+ The "dap4" singleton is removed and added to the mode list.
529+ 4. For backward compatibility, the values of "proto=" and "protocol="
530+ are removed from the fragment and their value is added to the mode list.
531+ 5. The final mode list is converted to a comma separated string
532+ and re-inserted into the fragment.
533+ 6. The final mode list is modified to remove duplicates.
534+
535+ The final result is the canonical form of the URL and is returned in the
536+ newpathp argument described above.
537+
532538*/
0 commit comments