From 83ef5ea3450b7f7732356121e2f95c3231fbe840 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Wed, 25 May 2011 13:19:47 +0000 Subject: [PATCH] Handle HTTP requests that are too long to fit into the server-side buffer --- org.glite.lb.common/src/mini_http.c | 2 +- org.glite.lb.server/src/bkserverd.c | 2 +- org.glite.lb.server/src/lb_http.c | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/org.glite.lb.common/src/mini_http.c b/org.glite.lb.common/src/mini_http.c index 8697fb6..e180c4c 100644 --- a/org.glite.lb.common/src/mini_http.c +++ b/org.glite.lb.common/src/mini_http.c @@ -87,7 +87,7 @@ edg_wll_ErrorCode edg_wll_http_recv(edg_wll_Context ctx,char **firstOut,char *** rdmore = 0; if (connPTR->bufUse >= connPTR->bufSize) { - edg_wll_SetError(ctx,EINVAL,"HTTP Request too long"); + edg_wll_SetError(ctx,E2BIG,"HTTP Request too long"); free(connPTR->buf); connPTR->buf = NULL; connPTR->bufUse = 0; connPTR->bufSize = 0; diff --git a/org.glite.lb.server/src/bkserverd.c b/org.glite.lb.server/src/bkserverd.c index d5d81b4..0fcb9c1 100644 --- a/org.glite.lb.server/src/bkserverd.c +++ b/org.glite.lb.server/src/bkserverd.c @@ -1454,6 +1454,7 @@ static int handle_server_error(edg_wll_Context ctx) case EPIPE: case EIO: case EDG_WLL_IL_PROTO: + case E2BIG: glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_WARN, "[%d] %s (%s)", getpid(), errt, errd); /* fallthrough @@ -1470,7 +1471,6 @@ static int handle_server_error(edg_wll_Context ctx) case EPERM: case EEXIST: case EDG_WLL_ERROR_NOINDEX: - case E2BIG: glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_WARN, "[%d] %s (%s)", getpid(), errt, errd); break; diff --git a/org.glite.lb.server/src/lb_http.c b/org.glite.lb.server/src/lb_http.c index b60f81a..4b4eb52 100644 --- a/org.glite.lb.server/src/lb_http.c +++ b/org.glite.lb.server/src/lb_http.c @@ -60,6 +60,9 @@ int edg_wll_AcceptHTTP(edg_wll_Context ctx, char **body, char **resp, char ***hd if ((err = edg_wll_Proto(ctx,req,hdr,*body,resp,hdrOut,bodyOut,httpErr))) edg_wll_Error(ctx,NULL,&err_desc); } + else + asprintf(resp,"HTTP/1.1 %d %s", HTTP_BADREQ, edg_wll_HTTPErrorMessage(HTTP_BADREQ)); + free(req); if (hdr) { -- 1.8.2.3