FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node/src/node_http_parser.cc at master · lazyprogrammer/node · GitHub
lazyprogrammer
/
node
Public
forked from
nodejs/node-v0.x-archive
Notifications
You must be signed in to change notification settings
Fork
1
Star
4
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
node
/
src
/
node_http_parser.cc
Copy path
More file actions
More file actions
Latest commit
History
History
History
639 lines (495 loc) · 18.1 KB
Breadcrumbs
node
/
src
/
node_http_parser.cc
Copy path
File metadata and controls
639 lines (495 loc) · 18.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
//
Copyright Joyent, Inc. and other Node contributors.
//
//
Permission is hereby granted, free of charge, to any person obtaining a
//
copy of this software and associated documentation files (the
//
"Software"), to deal in the Software without restriction, including
//
without limitation the rights to use, copy, modify, merge, publish,
//
distribute, sublicense, and/or sell copies of the Software, and to permit
//
persons to whom the Software is furnished to do so, subject to the
//
following conditions:
//
//
The above copyright notice and this permission notice shall be included
//
in all copies or substantial portions of the Software.
//
//
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
//
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
//
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
//
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
//
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
//
USE OR OTHER DEALINGS IN THE SOFTWARE.
#
include
<
node_http_parser.h
>
#
include
<
v8.h
>
#
include
<
node.h
>
#
include
<
node_buffer.h
>
#
include
<
http_parser.h
>
#
include
<
string.h
>
/*
strdup()
*/
#
if
!defined(_MSC_VER)
#
include
<
strings.h
>
/*
strcasecmp()
*/
#
else
#
define
strcasecmp
_stricmp
#
endif
#
include
<
stdlib.h
>
/*
free()
*/
//
This is a binding to http_parser (https://github.com/joyent/http-parser)
//
The goal is to decouple sockets from parsing for more javascript-level
//
agility. A Buffer is read from a socket and passed to parser.execute().
//
The parser then issues callbacks with slices of the data
//
parser.onMessageBegin
//
parser.onPath
//
parser.onBody
//
...
//
No copying is performed when slicing the buffer, only small reference
//
allocations.
#
include
<
node_vars.h
>
//
We do the following to minimize the detal between v0.6 branch. We want to
//
use the variables as they were being used before.
#
define
on_headers_sym
NODE_VAR
(on_headers_sym)
#
define
on_headers_complete_sym
NODE_VAR
(on_headers_complete_sym)
#
define
on_body_sym
NODE_VAR
(on_body_sym)
#
define
on_message_complete_sym
NODE_VAR
(on_message_complete_sym)
#
define
delete_sym
NODE_VAR
(delete_sym)
#
define
get_sym
NODE_VAR
(get_sym)
#
define
head_sym
NODE_VAR
(head_sym)
#
define
post_sym
NODE_VAR
(post_sym)
#
define
put_sym
NODE_VAR
(put_sym)
#
define
connect_sym
NODE_VAR
(connect_sym)
#
define
options_sym
NODE_VAR
(options_sym)
#
define
trace_sym
NODE_VAR
(trace_sym)
#
define
patch_sym
NODE_VAR
(patch_sym)
#
define
copy_sym
NODE_VAR
(copy_sym)
#
define
lock_sym
NODE_VAR
(lock_sym)
#
define
mkcol_sym
NODE_VAR
(mkcol_sym)
#
define
move_sym
NODE_VAR
(move_sym)
#
define
propfind_sym
NODE_VAR
(propfind_sym)
#
define
proppatch_sym
NODE_VAR
(proppatch_sym)
#
define
unlock_sym
NODE_VAR
(unlock_sym)
#
define
report_sym
NODE_VAR
(report_sym)
#
define
mkactivity_sym
NODE_VAR
(mkactivity_sym)
#
define
checkout_sym
NODE_VAR
(checkout_sym)
#
define
merge_sym
NODE_VAR
(merge_sym)
#
define
msearch_sym
NODE_VAR
(msearch_sym)
#
define
notify_sym
NODE_VAR
(notify_sym)
#
define
subscribe_sym
NODE_VAR
(subscribe_sym)
#
define
unsubscribe_sym
NODE_VAR
(unsubscribe_sym)
#
define
unknown_method_sym
NODE_VAR
(unknown_method_sym)
#
define
method_sym
NODE_VAR
(method_sym)
#
define
status_code_sym
NODE_VAR
(status_code_sym)
#
define
http_version_sym
NODE_VAR
(http_version_sym)
#
define
version_major_sym
NODE_VAR
(version_major_sym)
#
define
version_minor_sym
NODE_VAR
(version_minor_sym)
#
define
should_keep_alive_sym
NODE_VAR
(should_keep_alive_sym)
#
define
upgrade_sym
NODE_VAR
(upgrade_sym)
#
define
headers_sym
NODE_VAR
(headers_sym)
#
define
url_sym
NODE_VAR
(url_sym)
#
define
settings
NODE_VAR
(settings)
#
define
current_buffer
NODE_VAR
(current_buffer)
#
define
current_buffer_data
NODE_VAR
(current_buffer_data)
#
define
current_buffer_len
NODE_VAR
(current_buffer_len)
namespace node {
using
namespace
v8
;
//
gcc 3.x knows the always_inline attribute but fails at build time with a
//
"sorry, unimplemented: inlining failed" error when compiling at -O0
#
if
defined(__GNUC__)
#
if
__GNUC__ >= 4
#
define
always_inline
__attribute__
((always_inline))
#
else
#
define
always_inline
inline
#
endif
#
elif
defined(_MSC_VER)
#
define
always_inline
__forceinline
#
else
#
define
always_inline
#
endif
#
define
HTTP_CB
(
name
) \
static
int
name
(http_parser* p_) { \
Parser* self =
container_of
(p_, Parser, parser_); \
return
self->
name
##
_
(); \
} \
int
always_inline name##
_
()
#
define
HTTP_DATA_CB
(
name
) \
static
int
name
(http_parser* p_,
const
char
* at,
size_t
length) { \
Parser* self =
container_of
(p_, Parser, parser_); \
return
self->
name
##
_
(at, length); \
} \
int
always_inline name##
_
(
const
char
* at,
size_t
length)
static
inline
Persistent<String>
method_to_str
(
unsigned
short
m) {
switch
(m) {
case
HTTP_DELETE
:
return
delete_sym;
case
HTTP_GET
:
return
get_sym;
case
HTTP_HEAD
:
return
head_sym;
case
HTTP_POST
:
return
post_sym;
case
HTTP_PUT
:
return
put_sym;
case
HTTP_CONNECT
:
return
connect_sym;
case
HTTP_OPTIONS
:
return
options_sym;
case
HTTP_TRACE
:
return
trace_sym;
case
HTTP_PATCH
:
return
patch_sym;
case
HTTP_COPY
:
return
copy_sym;
case
HTTP_LOCK
:
return
lock_sym;
case
HTTP_MKCOL
:
return
mkcol_sym;
case
HTTP_MOVE
:
return
move_sym;
case
HTTP_PROPFIND
:
return
propfind_sym;
case
HTTP_PROPPATCH
:
return
proppatch_sym;
case
HTTP_UNLOCK
:
return
unlock_sym;
case
HTTP_REPORT
:
return
report_sym;
case
HTTP_MKACTIVITY
:
return
mkactivity_sym;
case
HTTP_CHECKOUT
:
return
checkout_sym;
case
HTTP_MERGE
:
return
merge_sym;
case
HTTP_MSEARCH
:
return
msearch_sym;
case
HTTP_NOTIFY
:
return
notify_sym;
case
HTTP_SUBSCRIBE
:
return
subscribe_sym;
case
HTTP_UNSUBSCRIBE
:
return
unsubscribe_sym;
default
:
return
unknown_method_sym;
}
}
//
helper class for the Parser
struct
StringPtr
{
StringPtr
() {
on_heap_ =
false
;
Reset
();
}
~StringPtr
() {
Reset
();
}
void
Reset
() {
if
(on_heap_) {
delete[]
str_;
on_heap_ =
false
;
}
str_ =
NULL
;
size_ =
0
;
}
void
Update
(
const
char
* str,
size_t
size) {
if
(str_ ==
NULL
)
str_ = str;
else
if
(on_heap_ || str_ + size != str) {
//
Non-consecutive input, make a copy on the heap.
//
TODO Use slab allocation, O(n) allocs is bad.
char
* s =
new
char
[size_ + size];
memcpy
(s, str_, size_);
memcpy
(s + size_, str, size);
if
(on_heap_)
delete[]
str_;
else
on_heap_ =
true
;
str_ = s;
}
size_ += size;
}
Handle<String>
ToString
()
const
{
if
(str_)
return
String::New
(str_, size_);
else
return
String::Empty
();
}
const
char
* str_;
bool
on_heap_;
size_t
size_;
};
class
Parser
:
public
ObjectWrap
{
public:
Parser
(
enum
http_parser_type type) : ObjectWrap() {
Init
(type);
}
~Parser
() {
}
HTTP_CB
(on_message_begin) {
num_fields_ = num_values_ = -
1
;
url_.
Reset
();
return
0
;
}
HTTP_DATA_CB
(on_url) {
url_.
Update
(at, length);
return
0
;
}
HTTP_DATA_CB
(on_header_field) {
if
(num_fields_ == num_values_) {
//
start of new field name
if
(++num_fields_ ==
ARRAY_SIZE
(fields_)) {
Flush
();
num_fields_ =
0
;
num_values_ = -
1
;
}
fields_[num_fields_].
Reset
();
}
assert
(num_fields_ < (
int
)
ARRAY_SIZE
(fields_));
assert
(num_fields_ == num_values_ +
1
);
fields_[num_fields_].
Update
(at, length);
return
0
;
}
HTTP_DATA_CB
(on_header_value) {
if
(num_values_ != num_fields_) {
//
start of new header value
values_[++num_values_].
Reset
();
}
assert
(num_values_ < (
int
)
ARRAY_SIZE
(values_));
assert
(num_values_ == num_fields_);
values_[num_values_].
Update
(at, length);
return
0
;
}
HTTP_CB
(on_headers_complete) {
Local<Value> cb = handle_->
Get
(on_headers_complete_sym);
if
(!cb->
IsFunction
())
return
0
;
Local<Object> message_info =
Object::New
();
if
(have_flushed_) {
//
Slow case, flush remaining headers.
Flush
();
}
else
{
//
Fast case, pass headers and URL to JS land.
message_info->
Set
(headers_sym,
CreateHeaders
());
if
(parser_.
type
==
HTTP_REQUEST
)
message_info->
Set
(url_sym, url_.
ToString
());
}
num_fields_ = num_values_ = -
1
;
//
METHOD
if
(parser_.
type
==
HTTP_REQUEST
) {
message_info->
Set
(method_sym,
method_to_str
(parser_.
method
));
}
//
STATUS
if
(parser_.
type
==
HTTP_RESPONSE
) {
message_info->
Set
(status_code_sym,
Integer::New
(parser_.
status_code
));
}
//
VERSION
message_info->
Set
(version_major_sym,
Integer::New
(parser_.
http_major
));
message_info->
Set
(version_minor_sym,
Integer::New
(parser_.
http_minor
));
message_info->
Set
(should_keep_alive_sym,
http_should_keep_alive
(&parser_) ?
True
() :
False
());
message_info->
Set
(upgrade_sym, parser_.
upgrade
?
True
() :
False
());
Local<Value> argv[
1
] = { message_info };
Local<Value> head_response =
Local<Function>::
Cast
(cb)->
Call
(handle_,
1
, argv);
if
(head_response.
IsEmpty
()) {
got_exception_ =
true
;
return
-
1
;
}
return
head_response->
IsTrue
() ?
1
:
0
;
}
HTTP_DATA_CB
(on_body) {
HandleScope scope;
Local<Value> cb = handle_->
Get
(on_body_sym);
if
(!cb->
IsFunction
())
return
0
;
Handle<Value> argv[
3
] = {
*current_buffer,
Integer::New
(at - current_buffer_data),
Integer::New
(length)
};
Local<Value> r = Local<Function>::
Cast
(cb)->
Call
(handle_,
3
, argv);
if
(r.
IsEmpty
()) {
got_exception_ =
true
;
return
-
1
;
}
return
0
;
}
HTTP_CB
(on_message_complete) {
HandleScope scope;
if
(num_fields_ != -
1
)
Flush
();
//
Flush trailing HTTP headers.
Local<Value> cb = handle_->
Get
(on_message_complete_sym);
if
(!cb->
IsFunction
())
return
0
;
Local<Value> r = Local<Function>::
Cast
(cb)->
Call
(handle_,
0
,
NULL
);
if
(r.
IsEmpty
()) {
got_exception_ =
true
;
return
-
1
;
}
return
0
;
}
static
Handle<Value>
New
(
const
Arguments& args) {
HandleScope scope;
http_parser_type type =
static_cast
<http_parser_type>(args[
0
]->
Int32Value
());
if
(type !=
HTTP_REQUEST
&& type !=
HTTP_RESPONSE
) {
return
ThrowException
(
Exception::Error
(
String::New
(
"
Argument must be HTTPParser.REQUEST or HTTPParser.RESPONSE
"
)));
}
Parser* parser =
new
Parser
(type);
parser->
Wrap
(args.
This
());
return
args.
This
();
}
//
var bytesParsed = parser->execute(buffer, off, len);
static
Handle<Value>
Execute
(
const
Arguments& args) {
HandleScope scope;
Parser* parser = ObjectWrap::Unwrap<Parser>(args.
This
());
assert
(!current_buffer);
assert
(!current_buffer_data);
if
(current_buffer) {
return
ThrowException
(
Exception::TypeError
(
String::New
(
"
Already parsing a buffer
"
)));
}
Local<Value> buffer_v = args[
0
];
if
(!
Buffer::HasInstance
(buffer_v)) {
return
ThrowException
(
Exception::TypeError
(
String::New
(
"
Argument should be a buffer
"
)));
}
Local<Object> buffer_obj = buffer_v->
ToObject
();
char
*buffer_data =
Buffer::Data
(buffer_obj);
size_t
buffer_len =
Buffer::Length
(buffer_obj);
size_t
off = args[
1
]->
Int32Value
();
if
(off >= buffer_len) {
return
ThrowException
(
Exception::Error
(
String::New
(
"
Offset is out of bounds
"
)));
}
size_t
len = args[
2
]->
Int32Value
();
if
(off+len > buffer_len) {
return
ThrowException
(
Exception::Error
(
String::New
(
"
Length is extends beyond buffer
"
)));
}
//
Assign 'buffer_' while we parse. The callbacks will access that varible.
current_buffer = &buffer_v;
current_buffer_data = buffer_data;
current_buffer_len = buffer_len;
parser->
got_exception_
=
false
;
size_t
nparsed =
http_parser_execute
(&parser->
parser_
, &settings, buffer_data + off, len);
//
Unassign the 'buffer_' variable
assert
(current_buffer);
current_buffer =
NULL
;
current_buffer_data =
NULL
;
//
If there was an exception in one of the callbacks
if
(parser->
got_exception_
)
return
Local<Value>();
Local<Integer> nparsed_obj =
Integer::New
(nparsed);
//
If there was a parse error in one of the callbacks
//
TODO What if there is an error on EOF?
if
(!parser->
parser_
.
upgrade
&& nparsed != len) {
Local<Value> e =
Exception::Error
(
String::NewSymbol
(
"
Parse Error
"
));
Local<Object> obj = e->
ToObject
();
obj->
Set
(
String::NewSymbol
(
"
bytesParsed
"
), nparsed_obj);
return
scope.
Close
(e);
}
else
{
return
scope.
Close
(nparsed_obj);
}
}
static
Handle<Value>
Finish
(
const
Arguments& args) {
HandleScope scope;
Parser* parser = ObjectWrap::Unwrap<Parser>(args.
This
());
assert
(!current_buffer);
parser->
got_exception_
=
false
;
int
rv =
http_parser_execute
(&(parser->
parser_
), &settings,
NULL
,
0
);
if
(parser->
got_exception_
)
return
Local<Value>();
if
(rv !=
0
) {
Local<Value> e =
Exception::Error
(
String::NewSymbol
(
"
Parse Error
"
));
Local<Object> obj = e->
ToObject
();
obj->
Set
(
String::NewSymbol
(
"
bytesParsed
"
),
Integer::New
(
0
));
return
scope.
Close
(e);
}
return
Undefined
();
}
static
Handle<Value>
Reinitialize
(
const
Arguments& args) {
HandleScope scope;
http_parser_type type =
static_cast
<http_parser_type>(args[
0
]->
Int32Value
());
if
(type !=
HTTP_REQUEST
&& type !=
HTTP_RESPONSE
) {
return
ThrowException
(
Exception::Error
(
String::New
(
"
Argument must be HTTPParser.REQUEST or HTTPParser.RESPONSE
"
)));
}
Parser* parser = ObjectWrap::Unwrap<Parser>(args.
This
());
parser->
Init
(type);
return
Undefined
();
}
private:
Local<Array>
CreateHeaders
() {
//
num_values_ is either -1 or the entry # of the last header
//
so num_values_ == 0 means there's a single header
Local<Array> headers =
Array::New
(
2
* (num_values_ +
1
));
for
(
int
i =
0
; i < num_values_ +
1
; ++i) {
headers->
Set
(
2
* i, fields_[i].
ToString
());
headers->
Set
(
2
* i +
1
, values_[i].
ToString
());
}
return
headers;
}
//
spill headers and request path to JS land
void
Flush
() {
HandleScope scope;
Local<Value> cb = handle_->
Get
(on_headers_sym);
if
(!cb->
IsFunction
())
return
;
Handle<Value> argv[
2
] = {
CreateHeaders
(),
url_.
ToString
()
};
Local<Value> r = Local<Function>::
Cast
(cb)->
Call
(handle_,
2
, argv);
if
(r.
IsEmpty
())
got_exception_ =
true
;
url_.
Reset
();
have_flushed_ =
true
;
}
void
Init
(
enum
http_parser_type type) {
http_parser_init
(&parser_, type);
url_.
Reset
();
num_fields_ = -
1
;
num_values_ = -
1
;
have_flushed_ =
false
;
got_exception_ =
false
;
}
http_parser parser_;
StringPtr fields_[
32
];
//
header fields
StringPtr values_[
32
];
//
header values
StringPtr url_;
int
num_fields_;
int
num_values_;
bool
have_flushed_;
bool
got_exception_;
};
void
InitHttpParser
(Handle<Object> target) {
HandleScope scope;
Local<FunctionTemplate> t =
FunctionTemplate::New
(Parser::New);
t->
InstanceTemplate
()->
SetInternalFieldCount
(
1
);
t->
SetClassName
(
String::NewSymbol
(
"
HTTPParser
"
));
PropertyAttribute attrib = (PropertyAttribute) (ReadOnly | DontDelete);
t->
Set
(
String::NewSymbol
(
"
REQUEST
"
),
Integer::New
(
HTTP_REQUEST
), attrib);
t->
Set
(
String::NewSymbol
(
"
RESPONSE
"
),
Integer::New
(
HTTP_RESPONSE
), attrib);
NODE_SET_PROTOTYPE_METHOD
(t,
"
execute
"
, Parser::Execute);
NODE_SET_PROTOTYPE_METHOD
(t,
"
finish
"
, Parser::Finish);
NODE_SET_PROTOTYPE_METHOD
(t,
"
reinitialize
"
, Parser::Reinitialize);
target->
Set
(
String::NewSymbol
(
"
HTTPParser
"
), t->
GetFunction
());
on_headers_sym =
NODE_PSYMBOL
(
"
onHeaders
"
);
on_headers_complete_sym =
NODE_PSYMBOL
(
"
onHeadersComplete
"
);
on_body_sym =
NODE_PSYMBOL
(
"
onBody
"
);
on_message_complete_sym =
NODE_PSYMBOL
(
"
onMessageComplete
"
);
delete_sym =
NODE_PSYMBOL
(
"
DELETE
"
);
get_sym =
NODE_PSYMBOL
(
"
GET
"
);
head_sym =
NODE_PSYMBOL
(
"
HEAD
"
);
post_sym =
NODE_PSYMBOL
(
"
POST
"
);
put_sym =
NODE_PSYMBOL
(
"
PUT
"
);
connect_sym =
NODE_PSYMBOL
(
"
CONNECT
"
);
options_sym =
NODE_PSYMBOL
(
"
OPTIONS
"
);
trace_sym =
NODE_PSYMBOL
(
"
TRACE
"
);
patch_sym =
NODE_PSYMBOL
(
"
PATCH
"
);
copy_sym =
NODE_PSYMBOL
(
"
COPY
"
);
lock_sym =
NODE_PSYMBOL
(
"
LOCK
"
);
mkcol_sym =
NODE_PSYMBOL
(
"
MKCOL
"
);
move_sym =
NODE_PSYMBOL
(
"
MOVE
"
);
propfind_sym =
NODE_PSYMBOL
(
"
PROPFIND
"
);
proppatch_sym =
NODE_PSYMBOL
(
"
PROPPATCH
"
);
unlock_sym =
NODE_PSYMBOL
(
"
UNLOCK
"
);
report_sym =
NODE_PSYMBOL
(
"
REPORT
"
);
mkactivity_sym =
NODE_PSYMBOL
(
"
MKACTIVITY
"
);
checkout_sym =
NODE_PSYMBOL
(
"
CHECKOUT
"
);
merge_sym =
NODE_PSYMBOL
(
"
MERGE
"
);
msearch_sym =
NODE_PSYMBOL
(
"
M-SEARCH
"
);
notify_sym =
NODE_PSYMBOL
(
"
NOTIFY
"
);
subscribe_sym =
NODE_PSYMBOL
(
"
SUBSCRIBE
"
);
unsubscribe_sym =
NODE_PSYMBOL
(
"
UNSUBSCRIBE
"
);;
unknown_method_sym =
NODE_PSYMBOL
(
"
UNKNOWN_METHOD
"
);
method_sym =
NODE_PSYMBOL
(
"
method
"
);
status_code_sym =
NODE_PSYMBOL
(
"
statusCode
"
);
http_version_sym =
NODE_PSYMBOL
(
"
httpVersion
"
);
version_major_sym =
NODE_PSYMBOL
(
"
versionMajor
"
);
version_minor_sym =
NODE_PSYMBOL
(
"
versionMinor
"
);
should_keep_alive_sym =
NODE_PSYMBOL
(
"
shouldKeepAlive
"
);
upgrade_sym =
NODE_PSYMBOL
(
"
upgrade
"
);
headers_sym =
NODE_PSYMBOL
(
"
headers
"
);
url_sym =
NODE_PSYMBOL
(
"
url
"
);
settings.
on_message_begin
= Parser::on_message_begin;
settings.
on_url
= Parser::on_url;
settings.
on_header_field
= Parser::on_header_field;
settings.
on_header_value
= Parser::on_header_value;
settings.
on_headers_complete
= Parser::on_headers_complete;
settings.
on_body
= Parser::on_body;
settings.
on_message_complete
= Parser::on_message_complete;
}
}
//
namespace node
NODE_MODULE
(node_http_parser, node::InitHttpParser)
Back
|
FazBrowse Home
|
New Git URL