Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 511f27e

Browse files
committed
Merge from iojs/master
Conflicts: README.md
2 parents 522887f + 3dafdc5 commit 511f27e

File tree

412 files changed

+4218
-1417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

412 files changed

+4218
-1417
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Ray Morgan <[email protected]>
9292
Ray Solomon <[email protected]>
9393
9494
Rick Olson <[email protected]>
95+
9596
Roman Reiss <[email protected]>
9697
Ryan Dahl <[email protected]>
9798
Ryan Emery <[email protected]>

AUTHORS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ Rohini Harendra <[email protected]>
576576
Chris Barber <[email protected]>
577577
Michael Kebe <[email protected]>
578578
Nick Muerdter <[email protected]>
579-
Roman Klauke <[email protected].com>
579+
Roman Klauke <romaaan.git@gmail.com>
580580
Xavi Magrinyà <[email protected]>
581581
582582
Ed Morley <[email protected]>
@@ -747,5 +747,9 @@ Peter Petrov <[email protected]>
747747
Andrew Crites <[email protected]>
748748
Marat Abdullin <[email protected]>
749749
Dan Varga <[email protected]>
750+
Nick Raienko <[email protected]>
751+
Guilherme Souza <[email protected]>
752+
Chris Yip <[email protected]>
753+
Christopher Monsanto <[email protected]>
750754

751755
# Generated by tools/update-authors.sh

CHANGELOG.md

Lines changed: 128 additions & 1 deletion
Large diffs are not rendered by default.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
3+
var common = require('../common.js');
4+
var bench = common.createBenchmark(main, {
5+
millions: [2]
6+
});
7+
8+
function main(conf) {
9+
var N = +conf.millions * 1e6;
10+
var n = 0;
11+
12+
function cb1(arg1) {
13+
n++;
14+
if (n === N)
15+
bench.end(n / 1e6);
16+
}
17+
function cb2(arg1, arg2) {
18+
n++;
19+
if (n === N)
20+
bench.end(n / 1e6);
21+
}
22+
function cb3(arg1, arg2, arg3) {
23+
n++;
24+
if (n === N)
25+
bench.end(n / 1e6);
26+
}
27+
28+
bench.start();
29+
for (var i = 0; i < N; i++) {
30+
if (i % 3 === 0)
31+
process.nextTick(cb3, 512, true, null);
32+
else if (i % 2 === 0)
33+
process.nextTick(cb2, false, 5.1);
34+
else
35+
process.nextTick(cb1, 0);
36+
}
37+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
'use strict';
2+
3+
var common = require('../common.js');
4+
var bench = common.createBenchmark(main, {
5+
millions: [2]
6+
});
7+
8+
process.maxTickDepth = Infinity;
9+
10+
function main(conf) {
11+
var n = +conf.millions * 1e6;
12+
13+
function cb3(arg1, arg2, arg3) {
14+
if (--n) {
15+
if (n % 3 === 0)
16+
process.nextTick(cb3, 512, true, null);
17+
else if (n % 2 === 0)
18+
process.nextTick(cb2, false, 5.1);
19+
else
20+
process.nextTick(cb1, 0);
21+
} else
22+
bench.end(+conf.millions);
23+
}
24+
function cb2(arg1, arg2) {
25+
if (--n) {
26+
if (n % 3 === 0)
27+
process.nextTick(cb3, 512, true, null);
28+
else if (n % 2 === 0)
29+
process.nextTick(cb2, false, 5.1);
30+
else
31+
process.nextTick(cb1, 0);
32+
} else
33+
bench.end(+conf.millions);
34+
}
35+
function cb1(arg1) {
36+
if (--n) {
37+
if (n % 3 === 0)
38+
process.nextTick(cb3, 512, true, null);
39+
else if (n % 2 === 0)
40+
process.nextTick(cb2, false, 5.1);
41+
else
42+
process.nextTick(cb1, 0);
43+
} else
44+
bench.end(+conf.millions);
45+
}
46+
bench.start();
47+
process.nextTick(cb1, true);
48+
}

deps/http_parser/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ tags
55
test
66
test_g
77
test_fast
8+
bench
89
url_parser
910
parsertrace
1011
parsertrace_g

deps/http_parser/.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Salman Haq <[email protected]>
55
Simon Zimmermann <[email protected]>
66
Thomas LE ROUX <[email protected]> LE ROUX Thomas <[email protected]>
77
Thomas LE ROUX <[email protected]> Thomas LE ROUX <[email protected]>
8+
Fedor Indutny <[email protected]>

deps/http_parser/.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ script:
1010
notifications:
1111
email: false
1212
irc:
13-
- "irc.freenode.net#libuv"
13+
- "irc.freenode.net#node-ci"

deps/http_parser/AUTHORS

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,29 @@ BogDan Vatra <[email protected]>
3939
Peter Faiman <[email protected]>
4040
Corey Richardson <[email protected]>
4141
Tóth Tamás <[email protected]>
42-
Patrik Stutz <[email protected]>
4342
Cam Swords <[email protected]>
4443
Chris Dickinson <[email protected]>
4544
Uli Köhler <[email protected]>
4645
Charlie Somerville <[email protected]>
46+
Patrik Stutz <[email protected]>
4747
Fedor Indutny <[email protected]>
4848
4949
Alexis Campailla <[email protected]>
5050
David Wragg <[email protected]>
51+
Vinnie Falco <[email protected]>
52+
Alex Butum <[email protected]>
53+
54+
Alex Kocharin <[email protected]>
55+
Mark Koopman <[email protected]>
56+
Helge Heß <[email protected]>
57+
Alexis La Goutte <[email protected]>
58+
George Miroshnykov <[email protected]>
59+
Maciej Małecki <[email protected]>
60+
Marc O'Morain <[email protected]>
61+
Jeff Pinner <[email protected]>
62+
Timothy J Fontaine <[email protected]>
63+
64+
Romain Giraud <[email protected]>
65+
Jay Satiro <[email protected]>
66+
Arne Steen <[email protected]>
67+
Kjell Schubert <[email protected]>

deps/http_parser/CONTRIBUTIONS

Lines changed: 0 additions & 4 deletions
This file was deleted.

deps/http_parser/Makefile

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,34 @@
1919
# IN THE SOFTWARE.
2020

2121
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
22-
SONAME ?= libhttp_parser.so.2.3
22+
SONAME ?= libhttp_parser.so.2.5.0
2323

2424
CC?=gcc
2525
AR?=ar
2626

27+
CPPFLAGS ?=
28+
LDFLAGS ?=
29+
2730
CPPFLAGS += -I.
2831
CPPFLAGS_DEBUG = $(CPPFLAGS) -DHTTP_PARSER_STRICT=1
2932
CPPFLAGS_DEBUG += $(CPPFLAGS_DEBUG_EXTRA)
3033
CPPFLAGS_FAST = $(CPPFLAGS) -DHTTP_PARSER_STRICT=0
3134
CPPFLAGS_FAST += $(CPPFLAGS_FAST_EXTRA)
35+
CPPFLAGS_BENCH = $(CPPFLAGS_FAST)
3236

3337
CFLAGS += -Wall -Wextra -Werror
3438
CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA)
3539
CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
40+
CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter
3641
CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
3742

3843
LDFLAGS_LIB = $(LDFLAGS) -shared
3944

45+
INSTALL ?= install
46+
PREFIX ?= $(DESTDIR)/usr/local
47+
LIBDIR = $(PREFIX)/lib
48+
INCLUDEDIR = $(PREFIX)/include
49+
4050
ifneq (darwin,$(PLATFORM))
4151
# TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname...
4252
LDFLAGS_LIB += -Wl,-soname=$(SONAME)
@@ -61,6 +71,12 @@ test_fast: http_parser.o test.o http_parser.h
6171
test.o: test.c http_parser.h Makefile
6272
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c test.c -o $@
6373

74+
bench: http_parser.o bench.o
75+
$(CC) $(CFLAGS_BENCH) $(LDFLAGS) http_parser.o bench.o -o $@
76+
77+
bench.o: bench.c http_parser.h Makefile
78+
$(CC) $(CPPFLAGS_BENCH) $(CFLAGS_BENCH) -c bench.c -o $@
79+
6480
http_parser.o: http_parser.c http_parser.h Makefile
6581
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c http_parser.c
6682

@@ -94,6 +110,21 @@ parsertrace_g: http_parser_g.o contrib/parsertrace.c
94110
tags: http_parser.c http_parser.h test.c
95111
ctags $^
96112

113+
install: library
114+
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
115+
$(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME)
116+
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so
117+
118+
install-strip: library
119+
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
120+
$(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME)
121+
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so
122+
123+
uninstall:
124+
rm $(INCLUDEDIR)/http_parser.h
125+
rm $(LIBDIR)/$(SONAME)
126+
rm $(LIBDIR)/libhttp_parser.so
127+
97128
clean:
98129
rm -f *.o *.a tags test test_fast test_g \
99130
http_parser.tar libhttp_parser.so.* \
@@ -102,4 +133,4 @@ clean:
102133
contrib/url_parser.c: http_parser.h
103134
contrib/parsertrace.c: http_parser.h
104135

105-
.PHONY: clean package test-run test-run-timed test-valgrind
136+
.PHONY: clean package test-run test-run-timed test-valgrind install install-strip uninstall

deps/http_parser/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if (recved < 0) {
6161
}
6262
6363
/* Start up / continue the parser.
64-
* Note we pass recved==0 to signal that EOF has been recieved.
64+
* Note we pass recved==0 to signal that EOF has been received.
6565
*/
6666
nparsed = http_parser_execute(parser, &settings, buf, recved);
6767
@@ -75,7 +75,7 @@ if (parser->upgrade) {
7575
HTTP needs to know where the end of the stream is. For example, sometimes
7676
servers send responses without Content-Length and expect the client to
7777
consume input (for the body) until EOF. To tell http_parser about EOF, give
78-
`0` as the forth parameter to `http_parser_execute()`. Callbacks and errors
78+
`0` as the fourth parameter to `http_parser_execute()`. Callbacks and errors
7979
can still be encountered during an EOF, so one must still be prepared
8080
to receive them.
8181

@@ -110,7 +110,7 @@ followed by non-HTTP data.
110110
information the Web Socket protocol.)
111111

112112
To support this, the parser will treat this as a normal HTTP message without a
113-
body. Issuing both on_headers_complete and on_message_complete callbacks. However
113+
body, issuing both on_headers_complete and on_message_complete callbacks. However
114114
http_parser_execute() will stop parsing at the end of the headers and return.
115115

116116
The user is expected to check if `parser->upgrade` has been set to 1 after
@@ -131,7 +131,7 @@ There are two types of callbacks:
131131
* notification `typedef int (*http_cb) (http_parser*);`
132132
Callbacks: on_message_begin, on_headers_complete, on_message_complete.
133133
* data `typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);`
134-
Callbacks: (requests only) on_uri,
134+
Callbacks: (requests only) on_url,
135135
(common) on_header_field, on_header_value, on_body;
136136

137137
Callbacks must return 0 on success. Returning a non-zero value indicates
@@ -145,7 +145,7 @@ buffer to avoid copying memory around if this fits your application.
145145

146146
Reading headers may be a tricky task if you read/parse headers partially.
147147
Basically, you need to remember whether last header callback was field or value
148-
and apply following logic:
148+
and apply the following logic:
149149

150150
(on_header_field and on_header_value shortened to on_h_*)
151151
------------------------ ------------ --------------------------------------------

0 commit comments

Comments
 (0)