Handle HTTP requests that are too long to fit into the server-side buffer
authorZdeněk Šustr <sustr4@cesnet.cz>
Wed, 25 May 2011 13:19:47 +0000 (13:19 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Wed, 25 May 2011 13:19:47 +0000 (13:19 +0000)
org.glite.lb.common/src/mini_http.c
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/lb_http.c

index 8697fb6..e180c4c 100644 (file)
@@ -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;
index d5d81b4..0fcb9c1 100644 (file)
@@ -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;
index b60f81a..4b4eb52 100644 (file)
@@ -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) {