Skip to content

Support HSDS 1.0 responses and request parsing - #135

Merged
jhendersonHDF merged 6 commits into
HDFGroup:masterfrom
mattjala:hsds_1_0_compat_master
Oct 5, 2026
Merged

jhendersonHDF merged 6 commits into
HDFGroup:masterfrom
mattjala:hsds_1_0_compat_master

Conversation

@mattjala

@mattjala mattjala commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator
  • Accept "file" as well as "h5domain" when reading an external link's target domain; HSDS 1.0 reports it under "file".
  • Treat a layout object with no "class" as absent when parsing dataset creation properties, because HSDS 1.0 returns an empty layout for datasets with a NULL dataspace.
  • Send a single Content-Type header on point-selection writes. The generic header was added before the point-selection branch appended its own, and newer aiohttp versions reject the duplicate with a 400.
  • In CI, use Python 3.12 (HSDS now requires >= 3.11) and drop the requests==2.31.0 downgrade, because HSDS's pinned requests-unixsocket no longer needs it.

Depends on #134. That's currently folded into this branch to get it to pass CI.

- Accept "file" as well as "h5domain" when reading an external link's
  target domain; HSDS 1.0 reports it under "file".
- Treat a layout object with no "class" as absent when parsing dataset
  creation properties, because HSDS 1.0 returns an empty layout for datasets
  with a NULL dataspace.
- Send a single Content-Type header on point-selection writes. The
  generic header was added before the point-selection branch appended
  its own, and newer aiohttp versions reject the duplicate with a 400.
- In CI, use Python 3.12 (HSDS now requires >= 3.11) and drop the
  requests==2.31.0 downgrade, because HSDS's pinned requests-unixsocket
  no longer needs it.
An http+unix:// endpoint only switched the connector into socket mode.
The socket path was hardcoded to /tmp/hs/sn_1.sock, so a server on any
other socket was silently bypassed in favor of whatever listened there.
Requests were also built against a placeholder base URL of "0", and the
socket was only configured from HSDS_ENDPOINT at init time, so an
http+unix:// hs_endpoint in .hscfg never used a socket at all. Reading
that endpoint from .hscfg also dereferenced a NULL base URL and kept a
pointer into the line buffer that the next fgets call overwrote.

The REST VOL now parses both endpoint sources the same way when connection
information is set: percent-decode the socket path from the endpoint, set it on the
cURL handle (clearing it for TCP endpoints), and send requests to
http://localhost. Socket endpoints that are not percent-encoded
are rejected.
…cfg line

File objects were allocated without zeroing, and connection info only
fills in a username and password when credentials are given. Without
credentials, RV_file_close freed uninitialized pointers, so a failed
H5Fopen/H5Fcreate segfaulted instead of returning an error. The cleanup
also ran before the object was marked as a file when setting connection
info failed. Zero file objects and set the fields RV_file_close relies
on before anything can fail.

Object visiting and attribute iteration on a file copied its username
and password with strlen, which crashed on a file opened without
credentials. Only copy them when they are set.

RV_calloc mapped to RV_malloc_debug when memory tracking was enabled,
so it did not zero memory in that configuration.

A blank line in .hscfg made strtok return NULL, which was then passed
to strcmp. Skip lines without a key.
@mattjala
mattjala force-pushed the hsds_1_0_compat_master branch from ff2ff26 to 3180536 Compare October 5, 2026 14:31
Comment thread src/rest_vol_dataset.c Outdated
/* Instruct cURL on which type of transfer to perform, binary or JSON. Point selections
* are always sent as a JSON body, so their Content-Type header is set below instead.
*/
if (H5S_SEL_POINTS != sel_type)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed? is_transfer_binary should have already been set above according to checking for H5S_SEL_POINTS, so the content-type should already be getting set to application/json

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was in order to avoid an issue where the point-selection branch would, later on, add a duplication application/json header that HSDS 1.0 rejects. That said, this can probably be handled more cleanly by keeping the unconditional one here and removing the other instance.

Comment thread src/rest_vol_link.c Outdated
@jhendersonHDF
jhendersonHDF merged commit 76a04e0 into HDFGroup:master Oct 5, 2026
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants