Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Is here a bug in on_body call? #482

Closed
ssrlive opened this issue Jun 7, 2019 · 1 comment
Closed

Is here a bug in on_body call? #482

ssrlive opened this issue Jun 7, 2019 · 1 comment

Comments

@ssrlive
Copy link

ssrlive commented Jun 7, 2019

When I test the bench code, I find some issue. Is it a bug?

When the on_body called, the input pointer at pointed to hello world, NOT to b.

Why?

static int on_body(http_parser* p, const char *at, size_t length) {
  return 0;
}

https://github.com/nodejs/http-parser/blob/master/bench.c#L45

image

And if it's NOT a bug, why?

@indutny
Copy link
Member

indutny commented Jun 7, 2019

There is a separate callback for chunk_header, if you need it. Usually, though, it would unwise to have a different API for chunked-encoding and fixed bodies.

TL;DR: This is desired behavior and not a bug.

Thanks for filing an issue, though!

@indutny indutny closed this as completed Jun 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants