int http_GetURL(struct http *hp, char **b);
void http_RecvHead(struct http *hp, int fd, struct event_base *eb, http_callback_f *func, void *arg);
void http_Dissect(struct http *sp, int fd, int rr);
-void http_BuildSbuf(int resp, struct sbuf *sb, struct http *hp);
+void http_BuildSbuf(int fd, int resp, struct sbuf *sb, struct http *hp);
/* cache_main.c */
extern pthread_mutex_t sessmtx;
VSL(SLT_Backend, sp->fd, "%d %s", fd, sp->backend->vcl_name);
hp = http_New();
- http_BuildSbuf(1, w->sb, sp->http);
+ http_BuildSbuf(fd, 1, w->sb, sp->http);
i = write(fd, sbuf_data(w->sb), sbuf_len(w->sb));
assert(i == sbuf_len(w->sb));
time(&t_req);
switch (http_GetStatus(hp)) {
case 200:
case 301:
- http_BuildSbuf(3, w->sb, hp);
+ http_BuildSbuf(sp->fd, 3, w->sb, hp);
/* XXX: fill in object from headers */
sp->obj->valid = 1;
sp->obj->cacheable = 1;
body = 1;
break;
case 304:
- http_BuildSbuf(3, w->sb, hp);
+ http_BuildSbuf(sp->fd, 3, w->sb, hp);
/* XXX: fill in object from headers */
sp->obj->valid = 1;
sp->obj->cacheable = 1;
} else
cls = 0;
- http_BuildSbuf(2, w->sb, hp);
+ http_BuildSbuf(sp->fd, 2, w->sb, hp);
vca_write_obj(sp, w->sb);
/*--------------------------------------------------------------------*/
void
-http_BuildSbuf(int resp, struct sbuf *sb, struct http *hp)
+http_BuildSbuf(int fd, int resp, struct sbuf *sb, struct http *hp)
{
unsigned u;
if (http_supress(hp->hdr[u], resp))
continue;
if (1)
- VSL(SLT_Debug, 0, "Build %s", hp->hdr[u]);
+ VSL(SLT_BldHdr, fd, "%s", hp->hdr[u]);
sbuf_cat(sb, hp->hdr[u]);
sbuf_cat(sb, "\r\n");
}
fd = VBE_GetFd(sp->backend, &fd_token);
assert(fd != -1);
- http_BuildSbuf(1, w->sb, sp->http);
+ http_BuildSbuf(fd, 1, w->sb, sp->http);
i = write(fd, sbuf_data(w->sb), sbuf_len(w->sb));
assert(i == sbuf_len(w->sb));
event_base_loop(w->eb, 0);
http_Dissect(hp, fd, 2);
- http_BuildSbuf(2, w->sb, hp);
+ http_BuildSbuf(sp->fd, 2, w->sb, hp);
vca_write(sp, sbuf_data(w->sb), sbuf_len(w->sb));
if (http_GetHdr(hp, "Content-Length", &b))
fd = VBE_GetFd(sp->backend, &fd_token);
assert(fd != -1);
- http_BuildSbuf(0, w->sb, sp->http); /* XXX: 0 ?? */
+ http_BuildSbuf(fd, 0, w->sb, sp->http); /* XXX: 0 ?? */
i = write(fd, sbuf_data(w->sb), sbuf_len(w->sb));
assert(i == sbuf_len(w->sb));
assert(__LINE__ == 0);