awslabs / aws-c-io

This is a module for the AWS SDK for C. It handles all IO and TLS work for application protocols.
Apache License 2.0
105 stars 58 forks source link

aws_tls_handler_write exists in header file, but there's no implementation? #624

Open quinnj opened 5 months ago

quinnj commented 5 months ago

Describe the bug

The tls_channel_handler.h file includes the following declaration:

/**
 * Not necessary if you are installing more handlers into the channel, but if you just want to have TLS for arbitrary
 * data and use the channel handler directly, this function allows you to write data to the channel and have it
 * encrypted.
 */
AWS_IO_API int aws_tls_handler_write(
    struct aws_channel_handler *handler,
    struct aws_channel_slot *slot,
    struct aws_byte_buf *buf,
    aws_channel_on_message_write_completed_fn *on_write_completed,
    void *completion_user_data);

But there doesn't seem to be a generic or any platform-specific implementations of the function.

Expected Behavior

Have an implementation of this function.

Current Behavior

Can't use the function

Reproduction Steps

Tried to use function but discovered I couldn't

Possible Solution

No response

Additional Information/Context

No response

aws-c-io version used

latest master

Compiler and version used

not exactly sure; can find out if needed

Operating System and version

pretty up-to-date macos

jmklix commented 4 months ago

Sorry for any confusion, but this was never implemented as you noticed. I've created a PR to remove it from the header file, but I would like to know more details about your use case and why you would like to use this function?

github-actions[bot] commented 4 months ago

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

quinnj commented 4 months ago

Sorry for any confusion, but this was never implemented as you noticed. I've created a PR to remove it from the header file, but I would like to know more details about your use case and why you would like to use this function?

Well, when I was originally reading through, I figured that using the on_data_read and aws_tls_handler_write would be simplest for my use case (just needing a plain socket + tls that I read/write to directly). But reading up a bit more, writing my own aws_channel_handler ended up not being as intimidating as I originally thought it would.

It seems to me that there could be a default read_write_handler (like the one in the tests) that did the channel_handler stuff for you and the user could just provide the on_data_read and then call write. Under the hood, the handler could either do the operations directly or queue operations up and then process like a lot of the http code does. Anyway, like I said, implementing your own handler actually isn't as scary as it may first seem, so maybe it's not a big deal.