opengeospatial / NamingAuthority

Primary repo for the OGC Naming Authority
6 stars 12 forks source link

Possibly invalid parameters in Simple Feature media type #194

Closed bradh closed 2 years ago

bradh commented 2 years ago

51 registered the GML 3.2 simple features profiles.

However it uses http://www.opengis.net/def/profile/ogc/2.0/gml-sf0 which is probably not conformant to the RFC 6838 value range for a parameter value (see https://www.rfc-editor.org/rfc/rfc6838#section-4.3) which requires this to be a restricted-name, which cannot contain a : or / character (see https://www.rfc-editor.org/rfc/rfc6838#section-4.2).

This is a problem for implementations that validate values. For example, Spring will throw an exception:

org.springframework.http.InvalidMediaTypeException: Invalid mime type "application/gml+xml;version=3.2;profile=http://www.opengis.net/def/profile/ogc/2.0/gml-sf0": Invalid token character ':' in token "http://www.opengis.net/def/profile/ogc/2.0/gml-sf0"
cportele commented 2 years ago

@ghobona

See https://github.com/opengeospatial/ogcapi-features/issues/759#issuecomment-1234518832 for my thoughts how to address this.

Also, there is a problem with the Definition Server, http://www.opengis.net/def/profile/ogc/gml/gml-sf0, http://www.opengis.net/def/profile/ogc/gml and http://www.opengis.net/def/profile all result in an error.

rob-metalinkage commented 2 years ago

The Definition server has the following:

http://www.opengis.net/def/profile/ogc/2.0/gml-sf0

@ghobona has something under the incubation tree here - we probably ought to at least mark it as experimental.

Can we identify the owner of the relevant register and the requirements here and we can update the content. We should look to annotate the scheme with relevant metadata about ownership.

We will also need to specify the relations that should exist between these and the relevant entries in the OGC document register:

https://defs.opengis.net/vocprez/search?search=simple+features+profile&from=http%3A%2F%2Fwww.opengis.net%2Fdef%2Fdocs

A PR can be submitted to this

ghobona commented 2 years ago

@rob-metalinkage http://www.opengis.net/def/profile/ogc/2.0/gml-sf0 is referenced by OGC API - Features - Part 1 and the IANA registration of the GML media type. So it is not experimental.

@bradh Thanks for reporting the issue. I have added the topic to the agenda of the OGC-NA session that is taking place October 3rd, 3:00 PM - 4:00 PM during the OGC Member Meeting (http://ogcmeet.org) in Singapore.

letmaik commented 2 years ago

I might be missing something, but https://www.rfc-editor.org/rfc/rfc6838#section-4.3 only seems to place a requirement on the parameter name, not the value.

There is no defined syntax for parameter values. Therefore, registrations MUST specify parameter value syntax. Additionally, some transports impose restrictions on parameter value syntax, so care needs be taken to limit the use of potentially problematic syntaxes; e.g., pure binary valued parameters, while permitted in some protocols, are best avoided.

Depending on the protocol, parameters may have to be encoded differently. See https://www.rfc-editor.org/rfc/rfc5987 for HTTP, which supports simple unquoted tokens and also quoted strings. I think a single URI would be an unquoted token, while multiple would be space separated and become a quoted string.

Python:

>>> import cgi
>>> cgi.parse_header("application/json;profile=http://foo.com")
('application/json', {'profile': 'http://foo.com'})
>>> cgi.parse_header('application/json;profile="http://foo.com http://bar.com"')
('application/json', {'profile': 'http://foo.com http://bar.com'})
cportele commented 2 years ago

@letmaik - I think you are correct, it looks like this is a non-issue (except for the error in the OGC definition server that still needs to be fixed).

BTW, a URI as a value must be quoted in a HTTP field since it contains separators (e.g. : or /).

letmaik commented 2 years ago

@cportele You're right, URIs in an HTTP field must be quoted. https://www.rfc-editor.org/rfc/rfc2616#section-2.2 contains the list of separators for reference.

bradh commented 2 years ago

So the ogc api examples that do not use quotes are wrong, but not a naming authority issue.