aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2008-09-20 23:51:45 +0200
committerStefan Bühler <stbuehler@web.de>2008-09-20 23:51:45 +0200
commit1b7ea9390ad62c107ea574a01fc2c32570f4a75a (patch)
treeb776a32fe6cfc6262ad2acccdb0be17eec454845
parent01d3a3b5df78a9944bae76d7faf3d04fe0164a19 (diff)
downloadfcgi-debug-1b7ea9390ad62c107ea574a01fc2c32570f4a75a.tar.gz
fcgi-debug-1b7ea9390ad62c107ea574a01fc2c32570f4a75a.zip
Change "from server"/"client" to "webserver"/"application"
-rw-r--r--src/connection.c4
-rw-r--r--src/fcgi-debug.h4
-rw-r--r--src/log.c4
-rw-r--r--src/parse-fastcgi.rl44
4 files changed, 30 insertions, 26 deletions
diff --git a/src/connection.c b/src/connection.c
index 0292aba..3630f2c 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -46,7 +46,7 @@ static char readbuf[4096];
static void fd_server_cb(struct ev_loop *loop, struct ev_io *w, int revents) {
connection *con = (connection*) w->data;
server *srv = con->srv;
- GString s;
+// GString s;
UNUSED(loop);
if (revents & EV_READ) {
@@ -74,7 +74,7 @@ static void fd_server_cb(struct ev_loop *loop, struct ev_io *w, int revents) {
static void fd_client_cb(struct ev_loop *loop, struct ev_io *w, int revents) {
connection *con = (connection*) w->data;
server *srv = con->srv;
- GString s;
+// GString s;
UNUSED(loop);
if (!connection_connect(con)) return;
diff --git a/src/fcgi-debug.h b/src/fcgi-debug.h
index 1082e35..a4cc946 100644
--- a/src/fcgi-debug.h
+++ b/src/fcgi-debug.h
@@ -112,4 +112,8 @@ void log_raw_split(const gchar *head, gboolean from_server, guint con_id, GStrin
/* debug-fastcgi.c */
void setup_debug_fastcgi(connection *con);
+static inline const char* from_server_to_string(gboolean from_server) {
+ return from_server ? "webserver" : "application";
+}
+
#endif \ No newline at end of file
diff --git a/src/log.c b/src/log.c
index e95c17c..9153803 100644
--- a/src/log.c
+++ b/src/log.c
@@ -30,7 +30,7 @@ void log_raw_split(const gchar *head, gboolean from_server, guint con_id, GStrin
g_string_append_c(line, c);
}
}
- g_print("%s from %s (%u): %s\n", head, from_server ? "server" : "client", con_id, line->str);
+ g_print("%s from %s (%u): %s\n", head, from_server_to_string(from_server), con_id, line->str);
start = i;
}
g_string_free(line, TRUE);
@@ -38,6 +38,6 @@ void log_raw_split(const gchar *head, gboolean from_server, guint con_id, GStrin
void log_raw(const gchar *head, gboolean from_server, guint con_id, GString *data) {
GString *line = g_string_escape(data);
- g_print("%s from %s (%u): %s\n", head, from_server ? "server" : "client", con_id, line->str);
+ g_print("%s from %s (%u): %s\n", head, from_server_to_string(from_server), con_id, line->str);
g_string_free(line, TRUE);
}
diff --git a/src/parse-fastcgi.rl b/src/parse-fastcgi.rl
index c9f8ab4..a9e7636 100644
--- a/src/parse-fastcgi.rl
+++ b/src/parse-fastcgi.rl
@@ -67,13 +67,13 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
guint8 flags;
if (ctx->FCGI_Record.contentLength != 8) {
g_print("wrong FCGI_BEGIN_REQUEST size from %s (%u): %u\n",
- ctx->from_server ? "server" : "client", ctx->con_id, (guint) ctx->FCGI_Record.contentLength);
+ from_server_to_string(ctx->from_server), ctx->con_id, (guint) ctx->FCGI_Record.contentLength);
return;
}
role = (p[0] << 8) | p[1];
flags = p[2];
g_print("begin request from %s (%u): role: %s, flags: %s\n",
- ctx->from_server ? "server" : "client", ctx->con_id,
+ from_server_to_string(ctx->from_server), ctx->con_id,
fcgi_role2string(role),
fcgi_flags2string(flags)
);
@@ -82,11 +82,11 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
case FCGI_ABORT_REQUEST: {
if (ctx->FCGI_Record.contentLength) {
g_print("wrong FCGI_ABORT_REQUEST size from %s (%u): %u\n",
- ctx->from_server ? "server" : "client", ctx->con_id, (guint) ctx->FCGI_Record.contentLength);
+ from_server_to_string(ctx->from_server), ctx->con_id, (guint) ctx->FCGI_Record.contentLength);
return;
}
g_print("abort request from %s (%u)\n",
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
break;
}
case FCGI_END_REQUEST: {
@@ -94,13 +94,13 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
guint8 protocolStatus;
if (ctx->FCGI_Record.contentLength != 8) {
g_print("wrong FCGI_END_REQUEST size from %s (%u): %u\n",
- ctx->from_server ? "server" : "client", ctx->con_id, (guint) ctx->FCGI_Record.contentLength);
+ from_server_to_string(ctx->from_server), ctx->con_id, (guint) ctx->FCGI_Record.contentLength);
return;
}
appStatus = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
protocolStatus = p[4];
g_print("end request from %s (%u): applicationStatus: %u, protocolStatus: %s\n",
- ctx->from_server ? "server" : "client", ctx->con_id,
+ from_server_to_string(ctx->from_server), ctx->con_id,
appStatus,
fcgi_protocol_status2string(protocolStatus)
);
@@ -111,7 +111,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
GString *s1, *s2;
if (!ctx->FCGI_Record.contentLength) {
g_print("params end from %s (%u)%s\n",
- ctx->from_server ? "server" : "client", ctx->con_id, ctx->s_params->len ? " (unexpected)" : "");
+ from_server_to_string(ctx->from_server), ctx->con_id, ctx->s_params->len ? " (unexpected)" : "");
return;
}
USE_STREAM(s_params, p, pe);
@@ -122,7 +122,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
s1 = g_string_escape(g_string_set_const(&tmp1, (gchar*) p, len1));
s2 = g_string_escape(g_string_set_const(&tmp2, (gchar*) p+len1, len2));
g_print("param from %s (%u): '%s' = '%s'\n",
- ctx->from_server ? "server" : "client", ctx->con_id,
+ from_server_to_string(ctx->from_server), ctx->con_id,
s1->str, s2->str);
g_string_free(s1, TRUE);
g_string_free(s2, TRUE);
@@ -134,7 +134,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
case FCGI_STDIN:
if (!ctx->FCGI_Record.contentLength) {
g_print("stdin closed from %s (%u)\n",
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
return;
}
log_raw_split("stdin", ctx->from_server, ctx->con_id, g_string_set_const(&tmp1, (gchar*) p, pe - p));
@@ -142,7 +142,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
case FCGI_STDOUT:
if (!ctx->FCGI_Record.contentLength) {
g_print("stdout closed from %s (%u)\n",
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
return;
}
log_raw_split("stdout", ctx->from_server, ctx->con_id, g_string_set_const(&tmp1, (gchar*) p, pe - p));
@@ -150,7 +150,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
case FCGI_STDERR:
if (!ctx->FCGI_Record.contentLength) {
g_print("stderr closed from %s (%u)\n",
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
return;
}
log_raw_split("stderr", ctx->from_server, ctx->con_id, g_string_set_const(&tmp1, (gchar*) p, pe - p));
@@ -158,7 +158,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
case FCGI_DATA:
if (!ctx->FCGI_Record.contentLength) {
g_print("data closed from %s (%u)\n",
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
return;
}
log_raw_split("data", ctx->from_server, ctx->con_id, g_string_set_const(&tmp1, (gchar*) p, pe - p));
@@ -169,7 +169,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
GString *s1, *s2;
if (!ctx->FCGI_Record.contentLength) {
g_print("empty get values from %s (%u)\n",
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
return;
}
while (get_key_value_pair_len(&p, pe, &len1, &len2)) {
@@ -180,11 +180,11 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
s2 = g_string_escape(g_string_set_const(&tmp2, (gchar*) p+len1, len2));
if (len2) {
g_print("get values from %s (%u): '%s' = '%s'?\n",
- ctx->from_server ? "server" : "client", ctx->con_id,
+ from_server_to_string(ctx->from_server), ctx->con_id,
s1->str, s2->str);
} else {
g_print("get values from %s (%u): '%s'\n",
- ctx->from_server ? "server" : "client", ctx->con_id,
+ from_server_to_string(ctx->from_server), ctx->con_id,
s1->str);
}
g_string_free(s1, TRUE);
@@ -193,7 +193,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
}
if (p != pe) {
g_print("unexpected end of get values from %s (%u)\n",
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
}
break;
}
@@ -203,7 +203,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
GString *s1, *s2;
if (!ctx->FCGI_Record.contentLength) {
g_print("empty get values result from %s (%u)\n",
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
return;
}
while (get_key_value_pair_len(&p, pe, &len1, &len2)) {
@@ -213,7 +213,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
s1 = g_string_escape(g_string_set_const(&tmp1, (gchar*) p, len1));
s2 = g_string_escape(g_string_set_const(&tmp2, (gchar*) p+len1, len2));
g_print("get values result from %s (%u): '%s' = '%s'\n",
- ctx->from_server ? "server" : "client", ctx->con_id,
+ from_server_to_string(ctx->from_server), ctx->con_id,
s1->str, s2->str);
g_string_free(s1, TRUE);
g_string_free(s2, TRUE);
@@ -221,7 +221,7 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
}
if (p != pe) {
g_print("unexpected end of get values result from %s (%u)\n",
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
}
break;
}
@@ -229,16 +229,16 @@ void fcgi_packet_parse(fcgi_context *ctx, guint8 *p, guint8 *pe) {
case FCGI_UNKNOWN_TYPE:
if (ctx->FCGI_Record.contentLength != 8) {
g_print("wrong FCGI_UNKNOWN_TYPE size from %s (%u): %u\n",
- ctx->from_server ? "server" : "client", ctx->con_id, (guint) ctx->FCGI_Record.contentLength);
+ from_server_to_string(ctx->from_server), ctx->con_id, (guint) ctx->FCGI_Record.contentLength);
return;
}
g_print("unknown type %u from %s (%u)\n", (guint) p[0],
- ctx->from_server ? "server" : "client", ctx->con_id);
+ from_server_to_string(ctx->from_server), ctx->con_id);
break;
default:
g_print("packet from %s (%u): type: %s, id: 0x%x, contentLength: 0x%x\n",
- ctx->from_server ? "server" : "client", ctx->con_id,
+ from_server_to_string(ctx->from_server), ctx->con_id,
fcgi_type2string(ctx->FCGI_Record.type),
(guint) ctx->FCGI_Record.requestID,
(guint) ctx->FCGI_Record.contentLength