aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2002-03-07 11:50:39 +0000
committertradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2002-03-07 11:50:39 +0000
commit8339cdb9f3214011af03f0140f90da0483cc15be (patch)
treebca4c86f8fcd64e375a8f47cdeca32663e7ba0ca
parent040e933cd88c2d6ee5ae5dd26cab90de69169fb7 (diff)
Print HTTP connect messages only if 'HTTPD::verbose' is set to "yes".
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@157 1faa4e14-9dd3-4be0-9f0e-ffe519881164
-rw-r--r--src/Sockets.c15
-rw-r--r--src/http.c14
2 files changed, 22 insertions, 7 deletions
diff --git a/src/Sockets.c b/src/Sockets.c
index 0eebf89..4cf670c 100644
--- a/src/Sockets.c
+++ b/src/Sockets.c
@@ -11,6 +11,7 @@
@@*/
#include "cctk.h"
+#include "cctk_Parameters.h"
#include "util_Network.h"
#include <stdio.h>
@@ -240,6 +241,8 @@ int HTTP_Poll(cGH *cctkGH, long sec, long usec)
httpSocket *this;
httpSocket *next;
+ DECLARE_CCTK_PARAMETERS
+
if(sec >=0)
{
@@ -278,11 +281,13 @@ int HTTP_Poll(cGH *cctkGH, long sec, long usec)
}
else
{
- fprintf (stderr,
- "Server: connect from host %s, port %hd.\n",
- inet_ntoa (clientname.sin_addr),
- ntohs (clientname.sin_port));
-
+ if (verbose)
+ {
+ CCTK_VInfo (CCTK_THORNSTRING,
+ "Server: connect from host %s, port %hd",
+ inet_ntoa (clientname.sin_addr),
+ ntohs (clientname.sin_port));
+ }
SocketCreate(new);
}
}
diff --git a/src/http.c b/src/http.c
index 7c23a73..58590ed 100644
--- a/src/http.c
+++ b/src/http.c
@@ -9,6 +9,7 @@
@@*/
#include "cctk.h"
+#include "cctk_Parameters.h"
#include <stdio.h>
#include <stdio.h>
@@ -388,6 +389,7 @@ static int DealWithRequest(cGH *cctkGH, httpRequest *request, char *buffer, int
char *method;
char *request_uri;
char *http_version;
+ DECLARE_CCTK_PARAMETERS
tmp = buffer;
@@ -428,14 +430,19 @@ static int DealWithRequest(cGH *cctkGH, httpRequest *request, char *buffer, int
if(method)
{
+#ifdef HTTP_DEBUG
printf("Method: %s\n", method);
+#endif
request->method = method;
}
if(request_uri)
{
- printf("URI: %s\n", request_uri);
+ if (verbose)
+ {
+ CCTK_VInfo (CCTK_THORNSTRING, "URI: %s", request_uri);
+ }
request->uri = request_uri;
StripArgs(request, request->uri);
@@ -443,8 +450,9 @@ static int DealWithRequest(cGH *cctkGH, httpRequest *request, char *buffer, int
if(http_version)
{
+#ifdef HTTP_DEBUG
printf("HTTP: %s\n", http_version);
-
+#endif
sscanf(http_version, "%*5s%d%*1[.]%d", &(request->http_major_version),
&(request->http_minor_version));
}
@@ -494,7 +502,9 @@ static int DealWithRequest(cGH *cctkGH, httpRequest *request, char *buffer, int
request->body_length = buffer + bufsize - request->body;
+#ifdef HTTP_DEBUG
printf("Replying...\n");
+#endif
if(!strcmp(request->method, "GET"))
{