r120 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Thu Apr 6 09:50:05 CEST 2006
Author: phk
Date: 2006-04-06 09:50:05 +0200 (Thu, 06 Apr 2006)
New Revision: 120
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_httpd.c
Log:
Add a function to (re)build a HTTP request or response into an sbuf.
Enable Id keyword
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2006-04-05 10:33:37 UTC (rev 119)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2006-04-06 07:50:05 UTC (rev 120)
@@ -3,6 +3,7 @@
*/
struct event_base;
+struct sbuf;
#ifdef EV_TIMEOUT
struct worker {
@@ -27,6 +28,7 @@
/* cache_httpd.c */
void HttpdAnalyze(struct sess *sp, int rr);
void HttpdGetHead(struct sess *sp, struct event_base *eb, sesscb_f *func);
+void HttpdBuildSbuf(int resp, int filter, struct sbuf *sb, struct sess *sp);
/* cache_main.c */
pthread_mutex_t sessmtx;
Property changes on: trunk/varnish-cache/bin/varnishd/cache.h
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/varnish-cache/bin/varnishd/cache_httpd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_httpd.c 2006-04-05 10:33:37 UTC (rev 119)
+++ trunk/varnish-cache/bin/varnishd/cache_httpd.c 2006-04-06 07:50:05 UTC (rev 120)
@@ -12,6 +12,7 @@
#include <pthread.h>
#include <ctype.h>
#include <event.h>
+#include <sbuf.h>
#include "libvarnish.h"
#include "shmlog.h"
@@ -181,3 +182,40 @@
event_base_set(eb, sp->rd_e);
event_add(sp->rd_e, NULL); /* XXX: timeout */
}
+
+/*--------------------------------------------------------------------*/
+
+void
+HttpdBuildSbuf(int resp, int filter, struct sbuf *sb, struct sess *sp)
+{
+
+ sbuf_clear(sb);
+ assert(sb != NULL);
+ if (resp) {
+ sbuf_cat(sb, sp->http.proto);
+ sbuf_cat(sb, " ");
+ sbuf_cat(sb, sp->http.status);
+ sbuf_cat(sb, " ");
+ sbuf_cat(sb, sp->http.response);
+ } else {
+ sbuf_cat(sb, sp->http.req);
+ sbuf_cat(sb, " ");
+ sbuf_cat(sb, sp->http.url);
+ sbuf_cat(sb, " ");
+ sbuf_cat(sb, sp->http.proto);
+ }
+ sbuf_cat(sb, "\r\n");
+#define HTTPH(a, b, c, d, e, f, g) \
+ do { \
+ if ((!filter || d) && sp->http.b != NULL) { \
+ sbuf_cat(sb, a ": "); \
+ sbuf_cat(sb, sp->http.b); \
+ sbuf_cat(sb, "\r\n"); \
+ } \
+ } while (0);
+#include "http_headers.h"
+#undef HTTPH
+ sbuf_cat(sb, "\r\n");
+ sbuf_finish(sb);
+
+}
Property changes on: trunk/varnish-cache/bin/varnishd/cache_httpd.c
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the varnish-commit
mailing list