Compare commits

...

5 Commits

Author SHA1 Message Date
Stefan Bühler 09ef98e7ae remove Makefile from debian branch 2013-05-10 14:07:11 +02:00
Stefan Bühler 6a008f7148 follow upstream fixes 2013-05-09 19:21:10 +02:00
Stefan Bühler d1913cac26 update debian changelog 2013-05-09 19:08:28 +02:00
Stefan Bühler e7dbbd757f Merge tag 'weighttp-0.3' into debian
weighttp v0.3
2013-05-09 19:06:36 +02:00
Stefan d86a398452 Debianize 2010-10-24 18:59:23 +00:00
12 changed files with 316 additions and 0 deletions

40
debian/changelog vendored Normal file
View File

@ -0,0 +1,40 @@
weighttp (0.3-3) unstable; urgency=low
* remove Makefile from debian branch, use quilt. fix Makefile.
-- Stefan Bühler <stbuehler@web.de> Fri, 10 May 2013 13:54:24 +0200
weighttp (0.3-2) unstable; urgency=low
[ Jyri J. Virkki ]
* Fix header parsing to compare HTTP header field names case insensitively. This fixes the problem where responses get incorrectly marked as errors if the response header field name case doesn't happen to match to what is in the code.
[ Ben Brown ]
* Corrected Host header handling (fixes #2477)
* User-Agent header no longer needs a leading space
-- Stefan Bühler <stbuehler@web.de> Thu, 09 May 2013 19:17:14 +0200
weighttp (0.3-1) unstable; urgency=low
* New upstream release
-- Stefan Bühler <stbuehler@web.de> Thu, 09 May 2013 19:07:56 +0200
weighttp (0.2-2) unstable; urgency=low
* Use old debhelper for backports
-- Stefan Bühler <source@stbuehler.de> Sun, 24 Oct 2010 18:49:44 +0000
weighttp (0.2-1) unstable; urgency=low
* Initial release
-- Stefan Bühler <source@stbuehler.de> Mon, 23 Aug 2010 12:58:47 +0000
weighttp (0.2-0) unstable; urgency=low
* Initial release
-- Stefan Bühler <source@stbuehler.de> Mon, 23 Aug 2010 12:58:46 +0000

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

26
debian/control vendored Normal file
View File

@ -0,0 +1,26 @@
Source: weighttp
Section: net
Priority: extra
Maintainer: Stefan Bühler <stbuehler@web.de>
Build-Depends: debhelper (>= 9), libev-dev
Standards-Version: 3.9.4
Homepage: http://weighttp.lighttpd.net/
Vcs-Git: git://git.lighttpd.net/weighttp
Vcs-Browser: http://cgit.lighttpd.net/weighttp/
Package: weighttp
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: lightweight and simple webserver benchmarking tool
weighttp was designed to be very fast and easy to use and only supports a
tiny fraction of the HTTP protocol in order to be lean and simple.
.
weighttp supports multithreading to make good use of modern CPUs with
multiple cores as well as asynchronous i/o for concurrent requests
within a single thread.
.
For event handling, weighty relies on libev which fits the design perfectly,
being lightweight and fast itself.
.
Thanks to that, weighty supports all modern high-performance event
interfaces like epoll or kqueue, that the major OSs provide.

44
debian/copyright vendored Normal file
View File

@ -0,0 +1,44 @@
This work was packaged for Debian by:
Stefan Bühler <source@stbuehler.de> on Mon, 23 Aug 2010 12:58:46 +0000
It was downloaded from:
http://weighttp.lighttpd.net/
Upstream Author:
Thomas Porzelt <tp@cryosphere.de>
Copyright:
Copyright (c) 2009 Thomas Porzelt
License:
The MIT License
Copyright (c) 2009 Thomas Porzelt
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.
The Debian packaging is:
Copyright (C) 2010 Stefan Bühler <source@stbuehler.de>

2
debian/docs vendored Normal file
View File

@ -0,0 +1,2 @@
README
TODO

View File

@ -0,0 +1,37 @@
From: =?UTF-8?q?Stefan=20B=C3=BChler?= <stbuehler@web.de>
Date: Fri, 10 May 2013 13:48:29 +0200
Subject: Makefile to replace waf handling
---
Makefile | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 Makefile
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..741b8a1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,22 @@
+
+all: weighttp
+
+override SOURCES := $(wildcard src/*.c)
+override OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
+
+# VERSION must be set in env
+
+LIBS += -lev -lpthread
+override CFLAGS += '-DVERSION="$(VERSION)"'
+
+weighttp: $(OBJECTS)
+ $(CC) $(LDFLAGS) -o weighttp $^ $(LIBS)
+
+install: weighttp
+ mkdir -p $(DESTDIR)/usr/bin
+ cp weighttp $(DESTDIR)/usr/bin/
+
+clean:
+ rm -f weighttp $(OBJECTS)
+
+.PHONY: all install clean

View File

@ -0,0 +1,57 @@
From: "Jyri J. Virkki" <jyri@virkki.com>
Date: Sun, 6 Jan 2013 02:21:09 -0800
Subject: =?UTF-8?q?Fix=20header=20parsing=20to=20compare=20HTTP=20header=20f?=
=?UTF-8?q?ield=20names=20case=0Ainsensitively.=20This=20fixes=20the=20probl?=
=?UTF-8?q?em=20where=20responses=20get=20incorrectly=0Amarked=20as=20errors?=
=?UTF-8?q?=20if=20the=20response=20header=20field=20name=20case=20doesn't=20?=
=?UTF-8?q?happen=0Ato=20match=20to=20what=20is=20in=20the=20code.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Also compare connection and transfer-encoding tokens case insensitively.
(Reference: RFC 2616: header field names are not case sensitive.)
Co-authored-by: Stefan Bühler <stbuehler@web.de>
---
src/client.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/client.c b/src/client.c
index f8875e4..dd48265 100644
--- a/src/client.c
+++ b/src/client.c
@@ -379,26 +379,24 @@ static uint8_t client_parse(Client *client, int size) {
str = &client->buffer[client->parser_offset];
//printf("checking header: '%s'\n", str);
- if (strncmp(str, "Content-Length: ", sizeof("Content-Length: ")-1) == 0) {
+ if (strncasecmp(str, "Content-Length: ", sizeof("Content-Length: ")-1) == 0) {
/* content length header */
client->content_length = str_to_uint64(str + sizeof("Content-Length: ") - 1);
- } else if (strncmp(str, "Connection: ", sizeof("Connection: ")-1) == 0) {
+ } else if (strncasecmp(str, "Connection: ", sizeof("Connection: ")-1) == 0) {
/* connection header */
str += sizeof("Connection: ") - 1;
- if (strncmp(str, "close", sizeof("close")-1) == 0)
+ if (strncasecmp(str, "close", sizeof("close")-1) == 0)
client->keepalive = 0;
- else if (strncmp(str, "Keep-Alive", sizeof("Keep-Alive")-1) == 0)
- client->keepalive = client->worker->config->keep_alive;
- else if (strncmp(str, "keep-alive", sizeof("keep-alive")-1) == 0)
+ else if (strncasecmp(str, "keep-alive", sizeof("keep-alive")-1) == 0)
client->keepalive = client->worker->config->keep_alive;
else
return 0;
- } else if (strncmp(str, "Transfer-Encoding: ", sizeof("Transfer-Encoding: ")-1) == 0) {
+ } else if (strncasecmp(str, "Transfer-Encoding: ", sizeof("Transfer-Encoding: ")-1) == 0) {
/* transfer encoding header */
str += sizeof("Transfer-Encoding: ") - 1;
- if (strncmp(str, "chunked", sizeof("chunked")-1) == 0)
+ if (strncasecmp(str, "chunked", sizeof("chunked")-1) == 0)
client->chunked = 1;
else
return 0;

View File

@ -0,0 +1,76 @@
From: Ben Brown <ben@427.org.uk>
Date: Tue, 19 Feb 2013 20:03:57 +0000
Subject: Corrected Host header handling (fixes #2477)
---
src/weighttp.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/src/weighttp.c b/src/weighttp.c
index 77504f1..a7744b5 100644
--- a/src/weighttp.c
+++ b/src/weighttp.c
@@ -76,9 +76,11 @@ static char *forge_request(char *url, char keep_alive, char **host, uint16_t *po
uint32_t len;
uint8_t i;
uint8_t have_user_agent;
+ char *header_host;
*host = NULL;
*port = 0;
+ header_host = NULL;
if (strncmp(url, "http://", 7) == 0)
url += 7;
@@ -137,6 +139,25 @@ static char *forge_request(char *url, char keep_alive, char **host, uint16_t *po
have_user_agent = 0;
for (i = 0; i < headers_num; i++) {
+ if (strncmp(headers[i], "Host:", sizeof("Host:")-1) == 0) {
+ if (header_host) {
+ W_ERROR("%s", "Duplicate Host header");
+ free(*host);
+ return NULL;
+ }
+ header_host = headers[i] + 5;
+ if (*header_host == ' ')
+ header_host++;
+
+ if (strlen(header_host) == 0) {
+ W_ERROR("%s", "Invalid Host header");
+ free(*host);
+ return NULL;
+ }
+
+ len += strlen(header_host);
+ continue;
+ }
len += strlen(headers[i]) + strlen("\r\n");
if (strncmp(headers[i], "User-Agent: ", sizeof("User-Agent: ")-1) == 0)
have_user_agent = 1;
@@ -150,9 +171,13 @@ static char *forge_request(char *url, char keep_alive, char **host, uint16_t *po
strcpy(req, "GET ");
strcat(req, url);
strcat(req, " HTTP/1.1\r\nHost: ");
- strcat(req, *host);
- if (*port != 80)
- sprintf(req + strlen(req), ":%"PRIu16, *port);
+ if (header_host) {
+ strcat(req, header_host);
+ } else {
+ strcat(req, *host);
+ if (*port != 80)
+ sprintf(req + strlen(req), ":%"PRIu16, *port);
+ }
strcat(req, "\r\n");
@@ -160,6 +185,8 @@ static char *forge_request(char *url, char keep_alive, char **host, uint16_t *po
sprintf(req + strlen(req), "User-Agent: weighttp/" VERSION "\r\n");
for (i = 0; i < headers_num; i++) {
+ if (strncmp(headers[i], "Host:", sizeof("Host:")-1) == 0)
+ continue;
strcat(req, headers[i]);
strcat(req, "\r\n");
}

View File

@ -0,0 +1,21 @@
From: Ben Brown <ben@427.org.uk>
Date: Tue, 19 Feb 2013 20:08:13 +0000
Subject: User-Agent header no longer needs a leading space
---
src/weighttp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/weighttp.c b/src/weighttp.c
index a7744b5..fa6af29 100644
--- a/src/weighttp.c
+++ b/src/weighttp.c
@@ -159,7 +159,7 @@ static char *forge_request(char *url, char keep_alive, char **host, uint16_t *po
continue;
}
len += strlen(headers[i]) + strlen("\r\n");
- if (strncmp(headers[i], "User-Agent: ", sizeof("User-Agent: ")-1) == 0)
+ if (strncmp(headers[i], "User-Agent:", sizeof("User-Agent:")-1) == 0)
have_user_agent = 1;
}

4
debian/patches/series vendored Normal file
View File

@ -0,0 +1,4 @@
0001-Makefile-to-replace-waf-handling.patch
0002-Fix-header-parsing-to-compare-HTTP-header-field-name.patch
0003-Corrected-Host-header-handling-fixes-2477.patch
0004-User-Agent-header-no-longer-needs-a-leading-space.patch

7
debian/rules vendored Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/make -f
VERSION := $(shell dpkg-parsechangelog | awk '/Version:/ { print $2 }' | sed -e 's/-[^-]*$$//')
export VERSION
%:
dh $@

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)