cnt_start(struct sess *sp)
{
int done;
+ char *p;
+ const char *r = "HTTP/1.1 100 Continue\r\n\r\n";
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
AZ(sp->restarts);
/* XXX: Handle TRACE & OPTIONS of Max-Forwards = 0 */
+ /*
+ * Handle Expect headers
+ */
+ if (http_GetHdr(sp->http, H_Expect, &p)) {
+ if (strcmp(p, "100-continue")) {
+ sp->err_code = 417;
+ sp->step = STP_ERROR;
+ return (0);
+ }
+
+ /* XXX: Don't bother with write failures for now */
+ (void)write(sp->fd, r, strlen(r));
+ http_Unset(sp->http, H_Expect);
+ }
+
sp->step = STP_RECV;
return (0);
}
/* Non-RFC2616 or CONNECT which is weird. */
pipe;
}
- if (req.http.Expect) {
- /* Expect is just too hard at present. */
- pipe;
- }
if (req.request != "GET" && req.request != "HEAD") {
/* We only deal with GET and HEAD by default */
pass;
--- /dev/null
+# $Id$
+
+test "Check Expect headers"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend { } -start
+
+client c1 {
+ txreq -url "/" -req POST -hdr "Expect: 100-continue " -body "foo"
+ rxresp
+ expect resp.status == 100
+ rxresp
+ expect resp.status == 200
+ txreq -url "/" -req POST -hdr "Expect: 101-continue" -body "foo"
+ rxresp
+ expect resp.status == 417
+} -run