| OpenHAP::HTTP(3p) | Perl Library Manual | OpenHAP::HTTP(3p) |
NAME
OpenHAP::HTTP - HTTP/1.1 parser for HAP protocol
SYNOPSIS
use OpenHAP::HTTP;
# Parse HTTP request
my $request = OpenHAP::HTTP::parse($data);
print $request->{method}, " ", $request->{path}, "\n";
# Build HTTP response
my $response = OpenHAP::HTTP::build_response(
status => 200,
headers => { 'Content-Type' => 'application/hap+json' },
body => $json_data,
);
DESCRIPTION
This module implements a simple HTTP/1.1 parser and response builder for the HomeKit Accessory Protocol.
FUNCTIONS
parse($data)
Parses HTTP request data and returns a hashref with: - method: HTTP method (GET, POST, PUT) - path: Request path - version: HTTP version - headers: Hash of headers (lowercase keys) - body: Request body
build_response(%args)
Builds an HTTP response. Arguments: - status: HTTP status code (default: 200) - status_text: Status text (auto-generated if not provided) - headers: Hashref of headers - body: Response body
SEE ALSO
spec/HAP-HTTP.md
| 2026-07-27 | OpenBSD |