Skip to content

Commit 3bc15a6

Browse files
bnoordhuisMylesBorins
authored andcommitted
deps: upgrade http-parser to v2.8.0
PR-URL: https://github.com/nodejs-private/http-parser-private/pull/1 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent 780a5d6 commit 3bc15a6

File tree

9 files changed

+452
-165
lines changed

9 files changed

+452
-165
lines changed

deps/http_parser/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ parsertrace_g
1212
*.mk
1313
*.Makefile
1414
*.so.*
15+
*.exe.*
16+
*.exe
1517
*.a
1618

1719

deps/http_parser/LICENSE-MIT

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
http_parser.c is based on src/http/ngx_http_parse.c from NGINX copyright
2-
Igor Sysoev.
3-
4-
Additional changes are licensed under the same terms as NGINX and
5-
copyright Joyent, Inc. and other Node contributors. All rights reserved.
1+
Copyright Joyent, Inc. and other Node contributors.
62

73
Permission is hereby granted, free of charge, to any person obtaining a copy
84
of this software and associated documentation files (the "Software"), to

deps/http_parser/Makefile

+25-14
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,22 @@
2121
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
2222
HELPER ?=
2323
BINEXT ?=
24+
SOLIBNAME = libhttp_parser
25+
SOMAJOR = 2
26+
SOMINOR = 8
27+
SOREV = 0
2428
ifeq (darwin,$(PLATFORM))
25-
SONAME ?= libhttp_parser.2.7.0.dylib
2629
SOEXT ?= dylib
30+
SONAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOEXT)
31+
LIBNAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOREV).$(SOEXT)
2732
else ifeq (wine,$(PLATFORM))
2833
CC = winegcc
2934
BINEXT = .exe.so
3035
HELPER = wine
3136
else
32-
SONAME ?= libhttp_parser.so.2.7.0
3337
SOEXT ?= so
38+
SONAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR)
39+
LIBNAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR).$(SOREV)
3440
endif
3541

3642
CC?=gcc
@@ -55,11 +61,13 @@ CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
5561
LDFLAGS_LIB = $(LDFLAGS) -shared
5662

5763
INSTALL ?= install
58-
PREFIX ?= $(DESTDIR)/usr/local
64+
PREFIX ?= /usr/local
5965
LIBDIR = $(PREFIX)/lib
6066
INCLUDEDIR = $(PREFIX)/include
6167

62-
ifneq (darwin,$(PLATFORM))
68+
ifeq (darwin,$(PLATFORM))
69+
LDFLAGS_LIB += -Wl,-install_name,$(LIBDIR)/$(SONAME)
70+
else
6371
# TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname...
6472
LDFLAGS_LIB += -Wl,-soname=$(SONAME)
6573
endif
@@ -102,7 +110,7 @@ libhttp_parser.o: http_parser.c http_parser.h Makefile
102110
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o
103111

104112
library: libhttp_parser.o
105-
$(CC) $(LDFLAGS_LIB) -o $(SONAME) $<
113+
$(CC) $(LDFLAGS_LIB) -o $(LIBNAME) $<
106114

107115
package: http_parser.o
108116
$(AR) rcs libhttp_parser.a http_parser.o
@@ -123,19 +131,22 @@ tags: http_parser.c http_parser.h test.c
123131
ctags $^
124132

125133
install: library
126-
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
127-
$(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME)
128-
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT)
134+
$(INSTALL) -D http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
135+
$(INSTALL) -D $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
136+
ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
137+
ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
129138

130139
install-strip: library
131-
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
132-
$(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME)
133-
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT)
140+
$(INSTALL) -D http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
141+
$(INSTALL) -D -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
142+
ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
143+
ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
134144

135145
uninstall:
136-
rm $(INCLUDEDIR)/http_parser.h
137-
rm $(LIBDIR)/$(SONAME)
138-
rm $(LIBDIR)/libhttp_parser.so
146+
rm $(DESTDIR)$(INCLUDEDIR)/http_parser.h
147+
rm $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
148+
rm $(DESTDIR)$(LIBDIR)/$(SONAME)
149+
rm $(DESTDIR)$(LIBDIR)/$(LIBNAME)
139150

140151
clean:
141152
rm -f *.o *.a tags test test_fast test_g \

deps/http_parser/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ if (parser->upgrade) {
7272
}
7373
```
7474

75-
HTTP needs to know where the end of the stream is. For example, sometimes
75+
`http_parser` 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
77-
consume input (for the body) until EOF. To tell http_parser about EOF, give
77+
consume input (for the body) until EOF. To tell `http_parser` about EOF, give
7878
`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.
@@ -93,7 +93,7 @@ the on_body callback.
9393
The Special Problem of Upgrade
9494
------------------------------
9595

96-
HTTP supports upgrading the connection to a different protocol. An
96+
`http_parser` supports upgrading the connection to a different protocol. An
9797
increasingly common example of this is the WebSocket protocol which sends
9898
a request like
9999

@@ -144,7 +144,7 @@ parse a request, and then give a response over that socket. By instantiation
144144
of a thread-local struct containing relevant data (e.g. accepted socket,
145145
allocated memory for callbacks to write into, etc), a parser's callbacks are
146146
able to communicate data between the scope of the thread and the scope of the
147-
callback in a threadsafe manner. This allows http-parser to be used in
147+
callback in a threadsafe manner. This allows `http_parser` to be used in
148148
multi-threaded contexts.
149149

150150
Example:
@@ -202,7 +202,7 @@ void http_parser_thread(socket_t sock) {
202202

203203
In case you parse HTTP message in chunks (i.e. `read()` request line
204204
from socket, parse, read half headers, parse, etc) your data callbacks
205-
may be called more than once. Http-parser guarantees that data pointer is only
205+
may be called more than once. `http_parser` guarantees that data pointer is only
206206
valid for the lifetime of callback. You can also `read()` into a heap allocated
207207
buffer to avoid copying memory around if this fits your application.
208208

deps/http_parser/contrib/parsertrace.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
/* Based on src/http/ngx_http_parse.c from NGINX copyright Igor Sysoev
2-
*
3-
* Additional changes are licensed under the same terms as NGINX and
4-
* copyright Joyent, Inc. and other Node contributors. All rights reserved.
1+
/* Copyright Joyent, Inc. and other Node contributors.
52
*
63
* Permission is hereby granted, free of charge, to any person obtaining a copy
74
* of this software and associated documentation files (the "Software"), to

0 commit comments

Comments
 (0)