struct hdr_ctx *ctx);
void http_sess_log(struct session *s);
void perform_http_redirect(struct session *s, struct stream_interface *si);
-void return_srv_error(struct session *s, int err_type);
+void http_return_srv_error(struct session *s, struct stream_interface *si);
#endif /* _PROTO_PROTO_HTTP_H */
long long bytes_in; /* number of bytes transferred from the client to the server */
long long bytes_out; /* number of bytes transferred from the server to the client */
} logs;
- void (*do_log)(struct session *s); /* the function to call in order to log */
+ void (*do_log)(struct session *s); /* the function to call in order to log (or NULL) */
+ void (*srv_error)(struct session *s, /* the function to call upon unrecoverable server errors (or NULL) */
+ struct stream_interface *si);
short int data_source; /* where to get the data we generate ourselves */
short int data_state; /* where to get the data we generate ourselves */
union {
else
s->do_log = tcp_sess_log;
+ if (p->mode == PR_MODE_HTTP)
+ s->srv_error = http_return_srv_error;
+ else
+ s->srv_error = NULL;
+
s->logs.accept_date = date; /* user-visible date for logging */
s->logs.tv_accept = now; /* corrected date for internal use */
tv_zero(&s->logs.tv_request);
s->srv->cum_sess++;
}
-/* Return the error message corresponding to err_type. It is assumed
+/* Return the error message corresponding to si->err_type. It is assumed
* that the server side is closed. Note that err_type is actually a
* bitmask, where almost only aborts may be cumulated with other
* values. We consider that aborted operations are more important
* being cumulated. It should normally not be possible to have multiple
* aborts at once, but just in case, the first one in sequence is reported.
*/
-void return_srv_error(struct session *s, int err_type)
+void http_return_srv_error(struct session *s, struct stream_interface *si)
{
- struct stream_interface *si = &s->si[1];
+ int err_type = si->err_type;
if (err_type & SI_ET_QUEUE_ABRT)
http_server_error(s, si, SN_ERR_CLICL, SN_FINST_Q,
si->ib->flags |= BF_READ_ERROR;
si->state = SI_ST_CLO;
- return_srv_error(s, si->err_type);
+ if (s->srv_error)
+ s->srv_error(s, si);
return 0;
}
/* no session was ever accounted for this server */
si->state = SI_ST_CLO;
- return_srv_error(s, si->err_type);
+ if (s->srv_error)
+ s->srv_error(s, si);
return;
}
if (!si->err_type)
si->err_type = SI_ET_QUEUE_TO;
si->state = SI_ST_CLO;
- return_srv_error(s, si->err_type);
+ if (s->srv_error)
+ s->srv_error(s, si);
return;
}
si->shutw(si);
si->err_type |= SI_ET_QUEUE_ABRT;
si->state = SI_ST_CLO;
- return_srv_error(s, si->err_type);
+ if (s->srv_error)
+ s->srv_error(s, si);
return;
}
si->shutw(si);
si->err_type |= SI_ET_CONN_ABRT;
si->state = SI_ST_CLO;
- return_srv_error(s, si->err_type);
+ if (s->srv_error)
+ s->srv_error(s, si);
return;
}
if (!si->err_type)
si->err_type = SI_ET_CONN_OTHER;
si->state = SI_ST_CLO;
- return_srv_error(s, si->err_type);
+ if (s->srv_error)
+ s->srv_error(s, si);
return;
}