nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.82k stars 305 forks source link

http_parser_settings' callback not called #66

Closed coanor closed 11 years ago

coanor commented 11 years ago

I ported webdis code into a HTTP server that only serve as a server.

I have read most of webdis source code. I use cscope to find where http_parser_settings's callback calling, but following callbacks not been called:

This confused me a lot. While a client object comes, I don't know whether it's request is complete, as I expect, while a client HTTP request complete, on_message_complete should be called.

Why set these callbacks that no code has really executed?

nicolasff commented 11 years ago

Hi,

These callbacks are called, from http-parser.c. The parser declares callbacks named on_something and calls them using the macro CALLBACK(something): https://github.com/nicolasff/webdis/blob/master/http-parser/http_parser.c#L59 Look for CALLBACK in http_parser.c and you'll find lots of them. This HTTP parsing library comes from Joyent.

cscope does not interpret preprocessor macros and therefore does not know what calls these functions.

Regards,

Nicolas

coanor commented 11 years ago

ohh, thanks a lot.