[MEDIUM] move all HTTP Request-related session material to struct hreq
The req_cap, hdr_state, hdr_idx, auth_hdr and req_line have been moved
to a dedicated hreq structure in the session. It makes is easier to
add HTTP-specific fields such as SOR (start of request) and EOF (end
of headers).
It also made it possible to fix two bugs introduced by last commit :
- end of headers not correctly detected
- hdr_idx not freed upon one specific error during session creation
When the backend side will be reworked, it should rely on a similar
structure.
diff --git a/src/session.c b/src/session.c
index 16047ea..23aca36 100644
--- a/src/session.c
+++ b/src/session.c
@@ -47,13 +47,13 @@
}
pool_free_to(s->fi->rsp_cap_pool, s->rsp_cap);
}
- if (s->req_cap != NULL) {
+ if (s->hreq.cap != NULL) {
struct cap_hdr *h;
for (h = s->fi->req_cap; h; h = h->next) {
- if (s->req_cap[h->index] != NULL)
- pool_free_to(h->pool, s->req_cap[h->index]);
+ if (s->hreq.cap[h->index] != NULL)
+ pool_free_to(h->pool, s->hreq.cap[h->index]);
}
- pool_free_to(s->fi->req_cap_pool, s->req_cap);
+ pool_free_to(s->fi->req_cap_pool, s->hreq.cap);
}
if (s->logs.uri)