ISO-TC211 / schemas-isotc211.github.io

Official ISO/TC 211 XML schemas site
https://schemas.isotc211.org
1 stars 1 forks source link

XSD schema files should be returned with proper mime-type #32

Closed ronaldtse closed 1 year ago

ronaldtse commented 1 year ago

From Heidi as per supplier: https://github.com/ISO-TC211/XML/issues/226

The import mentioned above behaves differently. "Normally", when we pressed such a link we get to a web page with some data. The new import leads to the download of an XSD file. Can this behaviour cause problems?

The content type currently returns application/octet-stream instead of application/xml.

The alternative mime type is application/schema+json.

The approach to do so is to fix the s3 upload command to set proper mime types on upload. For some reason S3 is too broken to accurately detect mime types.

ronaldtse commented 1 year ago

Fixed on main site. Apparently, aws s3 sync does not sync metadata information, i.e. it does not update the content-type. I had to manually remove all *.xml and *.xsd files, and re-trigger the upload, before the new content-type gets set. I could not find an option for aws s3 sync

Command I used:

$ aws s3 rm --recursive --region=us-east-1 --exclude "*" --include "*.xml" --include "*.xsd" s3://schemas.isotc211.org

Verification:

$ curl -v https://schemas.isotc211.org/19139/-/gmx/1.0/gmx.xsd
*   Trying 18.161.97.108:443...
* Connected to schemas.isotc211.org (18.161.97.108) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=schemas.isotc211.org
*  start date: Aug 20 00:00:00 2022 GMT
*  expire date: Sep 18 23:59:59 2023 GMT
*  subjectAltName: host "schemas.isotc211.org" matched cert's "schemas.isotc211.org"
*  issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x122011400)
> GET /19139/-/gmx/1.0/gmx.xsd HTTP/2
> Host: schemas.isotc211.org
> user-agent: curl/7.79.1
> accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 200 
< content-type: application/xml; charset=utf-8
< content-length: 1171
< date: Thu, 02 Feb 2023 02:33:45 GMT
< last-modified: Thu, 02 Feb 2023 02:23:26 GMT
< etag: "19f65f312a4ed74ac83512cc6536c995"
< server: AmazonS3
< vary: Accept-Encoding
< x-cache: Miss from cloudfront
< via: 1.1 b975c806f4011f8d213f0f1066a80674.cloudfront.net (CloudFront)
< x-amz-cf-pop: MRS52-P3
< x-amz-cf-id: asXKBZXx46K8Y8_fE26GEj7rZ7b6nuTqfi7Ckk2RKVLoiATiqVcdpw==
< 
<?xml   version="1.0" encoding="utf-8"?>
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:gmx="http://www.isotc211.org/2005/gmx"
    targetNamespace="http://www.isotc211.org/2005/gmx"
    elementFormDefault="qualified"
    version="2012-07-13">
    <!-- ================================= Annotation ================================ -->
    <xs:annotation>
        <xs:documentation>Geographic Metadata XML  (GMX) Schema is a component of the XML  Schema Implementation of Geographic Information Metadata documented in ISO/TS 19139:2007. GMX includes all the definitions of http://www.isotc211.org/2005/gmx namespace. The root document of this namespace is the file gmx.xsd.</xs:documentation>
    </xs:annotation>
    <!-- ================================== Imports ================================== -->
    <xs:include schemaLocation="gmxUsage.xsd"/>
    <!-- ########################################################################### -->
    <!-- ########################################################################### -->
    <!-- ================================== Classes ================================= -->
</xs:schema>
* Connection #0 to host schemas.isotc211.org left intact