Skip to content

Migrate multipart/form-data handling to the cpp-httplib >= 0.20 req.form API #409

@bburda

Description

@bburda

Summary

The gateway's multipart/form-data handling (bulk-data and script uploads) is written against the cpp-httplib multipart API that existed up to 0.15: the httplib::Request::files map and the httplib::MultipartFormData / httplib::MultipartFormDataItems types. cpp-httplib 0.26 (shipped by Ubuntu 26.04 / ROS 2 Lyrical) removed that surface in favour of a new req.form-based API.

As a result, medkit_find_cpp_httplib (in ros2_medkit_cmake) caps the system cpp-httplib at < 0.20 and falls back to the vendored 0.14.3 header on distros that ship 0.26+. This keeps Lyrical building, but pins us to the vendored copy, which then misses upstream fixes. The pin is meant to be temporary.


Proposed solution

Migrate the multipart code paths to the cpp-httplib >= 0.20 req.form API, decoupling the gateway's typed MultipartBody from the cpp-httplib struct names so handlers no longer depend on the removed types. Affected sites:

  • src/openapi/route_registry.hpp - multipart_upload<T>() reads req.files to populate MultipartBody.parts
  • include/ros2_medkit_gateway/http/response_types.hpp - MultipartBody::parts is typed as httplib::MultipartFormDataItems
  • src/http/handlers/bulkdata_handlers.cpp - consumes parts as httplib::MultipartFormData
  • src/http/handlers/script_handlers.cpp - same

Once migrated, drop the < 0.20 cap in medkit_find_cpp_httplib (both the pkg-config and find_package tiers) so the system package is used on Lyrical/Resolute.


Additional context

Blocks using the system cpp-httplib on Ubuntu 26.04 / ROS 2 Lyrical (and any future distro shipping 0.20+). Until then the vendored 0.14.3 header is used on those distros.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions