for (; vct_issp(*p); p++)
;
- /* Second field cannot contain SP, CRLF or CTL */
+ /* Second field cannot contain LWS */
hp->hd[h2].b = p;
- for (; !vct_issp(*p); p++)
- if (vct_isctl(*p))
- return (400);
+ for (; !vct_islws(*p); p++)
+ ;
hp->hd[h2].e = p;
+ if (!Tlen(hp->hd[h2]))
+ return (400);
+
/* Skip SP */
for (; vct_issp(*p); p++)
;
hp->status =
strtoul(hp->hd[HTTP_HDR_STATUS].b, NULL /* XXX */, 10);
}
- if (!Tlen(hp->hd[HTTP_HDR_RESPONSE])) {
+ if (hp->hd[HTTP_HDR_RESPONSE].b == NULL ||
+ !Tlen(hp->hd[HTTP_HDR_RESPONSE])) {
/* Backend didn't send a response string, use the standard */
hp->hd[HTTP_HDR_RESPONSE].b =
TRUST_ME(http_StatusMessage(hp->status));
--- /dev/null
+# $Id$
+
+test "Check lack of response-string"
+
+server s1 {
+ rxreq
+ send "HTTP/1.1 200 \r\n"
+ send "Connection: close\r\n"
+ send "\r\n"
+ send "\r\n"
+ send "FOO\r\n"
+} -start
+
+varnish v1 -vcl+backend {} -start
+
+client c1 {
+ txreq -url /bar
+ rxresp
+ expect resp.status == 200
+ expect resp.msg == OK
+} -run
+
+server s1 {
+ rxreq
+ send "HTTP/1.1 200\r\n"
+ send "Connection: close\r\n"
+ send "\r\n"
+ send "\r\n"
+ send "FOO\r\n"
+} -start
+
+client c1 {
+ txreq -url /foo
+ rxresp
+ expect resp.status == 200
+ expect resp.msg == OK
+} -run