Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] deferred_response never sends content string passed to constructor #331

Open
1 task done
jcphill opened this issue Aug 17, 2023 · 0 comments
Open
1 task done
Assignees
Labels
bug Confirmed bugs or reports that are very likely to be bugs.

Comments

@jcphill
Copy link
Contributor

jcphill commented Aug 17, 2023

Prerequisites

Description

The deferred_response constructor includes a const std::string& content = "" parameter that is documented as:

Besides the callback, optionally, you can provide a content parameter that sets the initial message sent immediately to the client.

The content parameter is passed to the base class string_response constructor where it is assigned to the content member but never actually consumed because string_response::get_raw_response() is never called.

This behavior might appear to have been removed by ed0841d in #145, but it likely didn't work even in eea93bd because get_raw_response() is a virtual function.

The tests don't expect the content parameter to be sent either:

LT_CHECK_EQ(s, "test42test84");

At this point in the interest of bug compatibility maybe just change the parameter name from "content" to "unused" and fix the docs.

Steps to Reproduce

Send a deferred_response with a non-empty content argument such as

return std::make_shared<deferred_response<test_data>>(test_callback_with_data, internal_info, "cycle callback response");

Expected behavior: Content argument is transmitted.

Actual behavior: Content argument is ignored.

Reproduces how often: 100%

Versions

  • OS version Linux hydrol2 4.18.0-477.15.1.el8_8.x86_64 #1 SMP Fri Jun 2 08:27:19 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux
  • libhttpserver verion 0.18.2 compiled
  • libmicrohttpd version 0.9.71 compiled

Additional Information

@jcphill jcphill added the bug Confirmed bugs or reports that are very likely to be bugs. label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs.
Projects
None yet
Development

No branches or pull requests

2 participants