This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
/
http.h
57 lines (42 loc) · 1.78 KB
/
http.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef node_http_h
#define node_http_h
#include <v8.h>
#include "net.h"
#include <http_parser.h>
namespace node {
class HTTPConnection : public Connection {
public:
static void Initialize (v8::Handle<v8::Object> target);
static v8::Persistent<v8::FunctionTemplate> client_constructor_template;
static v8::Persistent<v8::FunctionTemplate> server_constructor_template;
protected:
static v8::Handle<v8::Value> NewClient (const v8::Arguments& args);
static v8::Handle<v8::Value> NewServer (const v8::Arguments& args);
HTTPConnection (v8::Handle<v8::Object> handle,
enum http_parser_type type);
void OnReceive (const void *buf, size_t len);
static int on_message_begin (http_parser *parser);
static int on_uri (http_parser *parser, const char *at, size_t length);
static int on_header_field (http_parser *parser, const char *buf, size_t len);
static int on_header_value (http_parser *parser, const char *buf, size_t len);
static int on_headers_complete (http_parser *parser);
static int on_body (http_parser *parser, const char *buf, size_t len);
static int on_message_complete (http_parser *parser);
http_parser parser_;
friend class HTTPServer;
};
class HTTPServer : public Acceptor {
public:
static void Initialize (v8::Handle<v8::Object> target);
static v8::Persistent<v8::FunctionTemplate> constructor_template;
protected:
static v8::Handle<v8::Value> New (const v8::Arguments& args);
HTTPServer (v8::Handle<v8::Object> handle,
v8::Handle<v8::Function> protocol_class,
v8::Handle<v8::Object> options)
: Acceptor(handle, protocol_class, options) {}
v8::Handle<v8::FunctionTemplate> GetConnectionTemplate (void);
Connection* UnwrapConnection (v8::Local<v8::Object> connection);
};
} // namespace node
#endif