@@ -497,8 +497,77 @@ AWS_HTTP_API
497497void aws_http_headers_clear (struct aws_http_headers * headers );
498498
499499/**
500- * Create a new request message.
500+ * Get the `:method` value (HTTP/2 headers only).
501+ */
502+ AWS_HTTP_API
503+ int aws_http2_headers_get_request_method (const struct aws_http_headers * h2_headers , struct aws_byte_cursor * out_method );
504+
505+ /**
506+ * Set `:method` (HTTP/2 headers only).
507+ * The headers makes its own copy of the underlying string.
508+ */
509+ AWS_HTTP_API
510+ int aws_http2_headers_set_request_method (struct aws_http_headers * h2_headers , struct aws_byte_cursor method );
511+
512+ /*
513+ * Get the `:scheme` value (HTTP/2 headers only).
514+ */
515+ AWS_HTTP_API
516+ int aws_http2_headers_get_request_scheme (const struct aws_http_headers * h2_headers , struct aws_byte_cursor * out_scheme );
517+
518+ /**
519+ * Set `:scheme` (request pseudo headers only).
520+ * The pseudo headers makes its own copy of the underlying string.
521+ */
522+ AWS_HTTP_API
523+ int aws_http2_headers_set_request_scheme (struct aws_http_headers * h2_headers , struct aws_byte_cursor scheme );
524+
525+ /*
526+ * Get the `:authority` value (request pseudo headers only).
527+ */
528+ AWS_HTTP_API
529+ int aws_http2_headers_get_request_authority (
530+ const struct aws_http_headers * h2_headers ,
531+ struct aws_byte_cursor * out_authority );
532+
533+ /**
534+ * Set `:authority` (request pseudo headers only).
535+ * The pseudo headers makes its own copy of the underlying string.
536+ */
537+ AWS_HTTP_API
538+ int aws_http2_headers_set_request_authority (struct aws_http_headers * h2_headers , struct aws_byte_cursor authority );
539+
540+ /*
541+ * Get the `:path` value (request pseudo headers only).
542+ */
543+ AWS_HTTP_API
544+ int aws_http2_headers_get_request_path (const struct aws_http_headers * h2_headers , struct aws_byte_cursor * out_path );
545+
546+ /**
547+ * Set `:path` (request pseudo headers only).
548+ * The pseudo headers makes its own copy of the underlying string.
549+ */
550+ AWS_HTTP_API
551+ int aws_http2_headers_set_request_path (struct aws_http_headers * h2_headers , struct aws_byte_cursor path );
552+
553+ /**
554+ * Get `:status` (response pseudo headers only).
555+ * If no status is set, AWS_ERROR_HTTP_DATA_NOT_AVAILABLE is raised.
556+ */
557+ AWS_HTTP_API
558+ int aws_http2_headers_get_response_status (const struct aws_http_headers * h2_headers , int * out_status_code );
559+
560+ /**
561+ * Set `:status` (response pseudo headers only).
562+ */
563+ AWS_HTTP_API
564+ int aws_http2_headers_set_response_status (struct aws_http_headers * h2_headers , int status_code );
565+
566+ /**
567+ * Create a new HTTP/1.1 request message.
501568 * The message is blank, all properties (method, path, etc) must be set individually.
569+ * If HTTP/1.1 message used in HTTP/2 connection, the transformation will be automatically applied.
570+ * A HTTP/2 message will created and sent based on the HTTP/1.1 message.
502571 *
503572 * The caller has a hold on the object and must call aws_http_message_release() when they are done with it.
504573 */
@@ -515,14 +584,34 @@ struct aws_http_message *aws_http_message_new_request_with_headers(
515584 struct aws_http_headers * existing_headers );
516585
517586/**
518- * Create a new response message.
587+ * Create a new HTTP/1.1 response message.
519588 * The message is blank, all properties (status, headers, etc) must be set individually.
520589 *
521590 * The caller has a hold on the object and must call aws_http_message_release() when they are done with it.
522591 */
523592AWS_HTTP_API
524593struct aws_http_message * aws_http_message_new_response (struct aws_allocator * allocator );
525594
595+ /**
596+ * Create a new HTTP/2 request message.
597+ * pseudo headers need to be set from aws_http2_headers_set_request_* to the headers of the aws_http_message.
598+ * Will be errored out if used in HTTP/1.1 connection.
599+ *
600+ * The caller has a hold on the object and must call aws_http_message_release() when they are done with it.
601+ */
602+ AWS_HTTP_API
603+ struct aws_http_message * aws_http2_message_new_request (struct aws_allocator * allocator );
604+
605+ /**
606+ * Create a new HTTP/2 response message.
607+ * pseudo headers need to be set from aws_http2_headers_set_response_status to the headers of the aws_http_message.
608+ * Will be errored out if used in HTTP/1.1 connection.
609+ *
610+ * The caller has a hold on the object and must call aws_http_message_release() when they are done with it.
611+ */
612+ AWS_HTTP_API
613+ struct aws_http_message * aws_http2_message_new_response (struct aws_allocator * allocator );
614+
526615/**
527616 * Acquire a hold on the object, preventing it from being deleted until
528617 * aws_http_message_release() is called by all those with a hold on it.
@@ -549,6 +638,12 @@ bool aws_http_message_is_request(const struct aws_http_message *message);
549638AWS_HTTP_API
550639bool aws_http_message_is_response (const struct aws_http_message * message );
551640
641+ /**
642+ * Get the protocol version of the http message.
643+ */
644+ AWS_HTTP_API
645+ enum aws_http_version aws_http_message_get_protocol_version (const struct aws_http_message * message );
646+
552647/**
553648 * Get the method (request messages only).
554649 */
0 commit comments