Skip to content

Commit 59dc8b9

Browse files
johnhaley81John Haley
authored andcommitted
Revert "Merge pull request #931 from nodegit/bump-http-parser"
Bumping `http-parser` to 2.6.1 broke fetching/pulling from bitbucket in earlier versions of node somehow. This undoes that change and we'll have to look into fixing node v5.6.x later.
1 parent d63b3f1 commit 59dc8b9

File tree

10 files changed

+108
-514
lines changed

10 files changed

+108
-514
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
matrix:
1616
- export NODE_VERSION="0.12"
1717
- export NODE_VERSION="4.1"
18-
- export NODE_VERSION="5.6"
18+
- export NODE_VERSION="5.0"
1919

2020
matrix:
2121
fast_finish: true

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ environment:
3131
- nodejs_version: "0.12"
3232
# Node.js
3333
- nodejs_version: "4.1"
34-
- nodejs_version: "5.6"
34+
- nodejs_version: "5.0"
3535

3636
matrix:
3737
fast_finish: true

vendor/http_parser/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ parsertrace_g
1212
*.mk
1313
*.Makefile
1414
*.so.*
15-
*.exe.*
16-
*.exe
1715
*.a
1816

1917

vendor/http_parser/AUTHORS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,3 @@ Romain Giraud <giraud.romain@gmail.com>
6565
Jay Satiro <raysatiro@yahoo.com>
6666
Arne Steen <Arne.Steen@gmx.de>
6767
Kjell Schubert <kjell.schubert@gmail.com>
68-
Olivier Mengué <dolmen@cpan.org>

vendor/http_parser/Makefile

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,7 @@
1919
# IN THE SOFTWARE.
2020

2121
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
22-
HELPER ?=
23-
BINEXT ?=
24-
ifeq (darwin,$(PLATFORM))
25-
SONAME ?= libhttp_parser.2.6.1.dylib
26-
SOEXT ?= dylib
27-
else ifeq (wine,$(PLATFORM))
28-
CC = winegcc
29-
BINEXT = .exe.so
30-
HELPER = wine
31-
else
32-
SONAME ?= libhttp_parser.so.2.6.1
33-
SOEXT ?= so
34-
endif
22+
SONAME ?= libhttp_parser.so.2.5.0
3523

3624
CC?=gcc
3725
AR?=ar
@@ -65,8 +53,8 @@ LDFLAGS_LIB += -Wl,-soname=$(SONAME)
6553
endif
6654

6755
test: test_g test_fast
68-
$(HELPER) ./test_g$(BINEXT)
69-
$(HELPER) ./test_fast$(BINEXT)
56+
./test_g
57+
./test_fast
7058

7159
test_g: http_parser_g.o test_g.o
7260
$(CC) $(CFLAGS_DEBUG) $(LDFLAGS) http_parser_g.o test_g.o -o $@
@@ -93,7 +81,7 @@ http_parser.o: http_parser.c http_parser.h Makefile
9381
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c http_parser.c
9482

9583
test-run-timed: test_fast
96-
while(true) do time $(HELPER) ./test_fast$(BINEXT) > /dev/null; done
84+
while(true) do time ./test_fast > /dev/null; done
9785

9886
test-valgrind: test_g
9987
valgrind ./test_g
@@ -114,23 +102,23 @@ url_parser_g: http_parser_g.o contrib/url_parser.c
114102
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o $@
115103

116104
parsertrace: http_parser.o contrib/parsertrace.c
117-
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o parsertrace$(BINEXT)
105+
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o parsertrace
118106

119107
parsertrace_g: http_parser_g.o contrib/parsertrace.c
120-
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o parsertrace_g$(BINEXT)
108+
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o parsertrace_g
121109

122110
tags: http_parser.c http_parser.h test.c
123111
ctags $^
124112

125113
install: library
126114
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
127115
$(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME)
128-
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT)
116+
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so
129117

130118
install-strip: library
131119
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
132120
$(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME)
133-
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT)
121+
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so
134122

135123
uninstall:
136124
rm $(INCLUDEDIR)/http_parser.h
@@ -140,8 +128,7 @@ uninstall:
140128
clean:
141129
rm -f *.o *.a tags test test_fast test_g \
142130
http_parser.tar libhttp_parser.so.* \
143-
url_parser url_parser_g parsertrace parsertrace_g \
144-
*.exe *.exe.so
131+
url_parser url_parser_g parsertrace parsertrace_g
145132

146133
contrib/url_parser.c: http_parser.h
147134
contrib/parsertrace.c: http_parser.h

vendor/http_parser/README.md

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
HTTP Parser
22
===========
33

4-
[![Build Status](https://api.travis-ci.org/nodejs/http-parser.svg?branch=master)](https://travis-ci.org/nodejs/http-parser)
4+
[![Build Status](https://travis-ci.org/joyent/http-parser.png?branch=master)](https://travis-ci.org/joyent/http-parser)
55

66
This is a parser for HTTP messages written in C. It parses both requests and
77
responses. The parser is designed to be used in performance HTTP
@@ -94,7 +94,7 @@ The Special Problem of Upgrade
9494
------------------------------
9595

9696
HTTP supports upgrading the connection to a different protocol. An
97-
increasingly common example of this is the WebSocket protocol which sends
97+
increasingly common example of this is the Web Socket protocol which sends
9898
a request like
9999

100100
GET /demo HTTP/1.1
@@ -106,8 +106,8 @@ a request like
106106

107107
followed by non-HTTP data.
108108

109-
(See [RFC6455](https://tools.ietf.org/html/rfc6455) for more information the
110-
WebSocket protocol.)
109+
(See http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75 for more
110+
information the Web Socket protocol.)
111111

112112
To support this, the parser will treat this as a normal HTTP message without a
113113
body, issuing both on_headers_complete and on_message_complete callbacks. However
@@ -137,69 +137,6 @@ There are two types of callbacks:
137137
Callbacks must return 0 on success. Returning a non-zero value indicates
138138
error to the parser, making it exit immediately.
139139

140-
For cases where it is necessary to pass local information to/from a callback,
141-
the `http_parser` object's `data` field can be used.
142-
An example of such a case is when using threads to handle a socket connection,
143-
parse a request, and then give a response over that socket. By instantiation
144-
of a thread-local struct containing relevant data (e.g. accepted socket,
145-
allocated memory for callbacks to write into, etc), a parser's callbacks are
146-
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
148-
multi-threaded contexts.
149-
150-
Example:
151-
```
152-
typedef struct {
153-
socket_t sock;
154-
void* buffer;
155-
int buf_len;
156-
} custom_data_t;
157-
158-
159-
int my_url_callback(http_parser* parser, const char *at, size_t length) {
160-
/* access to thread local custom_data_t struct.
161-
Use this access save parsed data for later use into thread local
162-
buffer, or communicate over socket
163-
*/
164-
parser->data;
165-
...
166-
return 0;
167-
}
168-
169-
...
170-
171-
void http_parser_thread(socket_t sock) {
172-
int nparsed = 0;
173-
/* allocate memory for user data */
174-
custom_data_t *my_data = malloc(sizeof(custom_data_t));
175-
176-
/* some information for use by callbacks.
177-
* achieves thread -> callback information flow */
178-
my_data->sock = sock;
179-
180-
/* instantiate a thread-local parser */
181-
http_parser *parser = malloc(sizeof(http_parser));
182-
http_parser_init(parser, HTTP_REQUEST); /* initialise parser */
183-
/* this custom data reference is accessible through the reference to the
184-
parser supplied to callback functions */
185-
parser->data = my_data;
186-
187-
http_parser_settings settings; / * set up callbacks */
188-
settings.on_url = my_url_callback;
189-
190-
/* execute parser */
191-
nparsed = http_parser_execute(parser, &settings, buf, recved);
192-
193-
...
194-
/* parsed information copied from callback.
195-
can now perform action on data copied into thread-local memory from callbacks.
196-
achieves callback -> thread information flow */
197-
my_data->buffer;
198-
...
199-
}
200-
201-
```
202-
203140
In case you parse HTTP message in chunks (i.e. `read()` request line
204141
from socket, parse, read half headers, parse, etc) your data callbacks
205142
may be called more than once. Http-parser guarantees that data pointer is only

vendor/http_parser/contrib/url_parser.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ int main(int argc, char ** argv) {
3535
connect = strcmp("connect", argv[1]) == 0 ? 1 : 0;
3636
printf("Parsing %s, connect %d\n", argv[2], connect);
3737

38-
http_parser_url_init(&u);
3938
result = http_parser_parse_url(argv[2], len, connect, &u);
4039
if (result != 0) {
4140
printf("Parse error : %d\n", result);
@@ -44,4 +43,4 @@ int main(int argc, char ** argv) {
4443
printf("Parse ok, result : \n");
4544
dump_url(argv[2], &u);
4645
return 0;
47-
}
46+
}

0 commit comments

Comments
 (0)