Skip to content

service_error_handler 400 - End of file when sending http header connection:keep-alive #552

@stan-yu

Description

@stan-yu

Hi,

related to the issue #399

I have the same error with number 400, and exception.what() is "End of file" in custom error_handler.
To reproduce this error, I took your example documentation/example/HTTP_PIPELINING.md and modified it slightly in the error handler part:

void error_handler(const int status_code, const exception& error, const shared_ptr<Session>& session) { /* here error is made a constant reference */
  fprintf(stderr, "status: %d, er: %s", status_code, error.what()); // added error output
  if (session not_eq nullptr and session->is_open()) {
  ...

After that, compile and run the example, and send a request to the service:
curl -w'\n' -v --header 'Connection: keep-alive' -X GET 'http://localhost:1984/resource/1'

output on stderr:
status: 400, er: End of file

If do not add a custom error handler (i.e. comment out the line service.set_error_handler(error_handler);), the service does not output any errors.
I have this error reproduced on Ubuntu 22.04 and Oracle Linux 8.10.

Is this expected behavior? Or if the session is closed, this error can be ignored?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions