Reduced debug output. #9

This commit is contained in:
gardners 2012-10-03 08:42:49 +02:00
parent 4e0c0064ba
commit 33107e795f
3 changed files with 10 additions and 17 deletions

View File

@ -224,15 +224,15 @@ int rhizome_manifest_check_file(rhizome_manifest *m_in)
return 0;
}
if (gotfile) {
DEBUGF("Skipping file checks for bundle, as file is already in the database");
/* Skipping file checks for bundle, as file is already in the database */
return 0;
}
/* Find out whether the payload is expected to be encrypted or not */
m_in->payloadEncryption=rhizome_manifest_get_ll(m_in, "crypt");
/* Check payload file is accessible and discover its length, then check that it matches
the file size stored in the manifest */
/* Check payload file is accessible and discover its length, then check that it
matches the file size stored in the manifest */
long long mfilesize = rhizome_manifest_get_ll(m_in, "filesize");
m_in->fileLength = 0;
if (m_in->dataFileName && m_in->dataFileName[0]) {

View File

@ -35,7 +35,7 @@ int rhizome_direct_clear_temporary_files(rhizome_http_request *r)
for(i=0;fields[i];i++) {
snprintf(filename,1024,"rhizomedirect.%d.%s",r->alarm.poll.fd,fields[i]);
filename[1023]=0;
DEBUGF("Unlinking '%s'",filename);
unlink(filename);
}
return 0;
}
@ -178,13 +178,13 @@ int rhizome_direct_form_received(rhizome_http_request *r)
if (strcmp(inet_ntoa(r->requestor.sin_addr),
confValueGet("rhizome.api.addfile.allowedaddress","127.0.0.1")))
{
DEBUGF("Request was from %s, but is only allowed from %s",
DEBUGF("rhizome.api.addfile request received from %s, but is only allowed from %s",
inet_ntoa(r->requestor.sin_addr),
confValueGet("rhizome.api.addfile.allowedaddress",
"127.0.0.1"));
rhizome_direct_clear_temporary_files(r);
return rhizome_server_simple_http_response(r,400,"Not available from here.");
return rhizome_server_simple_http_response(r,404,"Not available from here.");
}
switch(r->fields_seen) {
@ -250,7 +250,6 @@ int rhizome_direct_form_received(rhizome_http_request *r)
} else {
if (debug & DEBUG_RHIZOME) DEBUGF("manifest contains name=\"%s\"", name);
}
DEBUGF("File name = '%s'",name);
const char *senderhex
= rhizome_manifest_get(m, "sender", NULL, 0);
@ -378,8 +377,6 @@ int rhizome_direct_process_mime_line(rhizome_http_request *r,char *buffer,int co
int blankLine=0;
if (!strcmp(buffer,"\r\n")) blankLine=1;
DEBUGF("mime state 0x%x, blankLine=%d, boundary=%d, EOF=%d, bytes=%d",
r->source_flags,blankLine,boundaryLine,endOfForm,count);
switch(r->source_flags) {
case RD_MIME_STATE_INITIAL:
if (boundaryLine) r->source_flags=RD_MIME_STATE_PARTHEADERS;
@ -387,7 +384,6 @@ int rhizome_direct_process_mime_line(rhizome_http_request *r,char *buffer,int co
case RD_MIME_STATE_PARTHEADERS:
case RD_MIME_STATE_MANIFESTHEADERS:
case RD_MIME_STATE_DATAHEADERS:
DEBUGF("mime line %s", alloca_str_toprint(r->request));
if (blankLine) {
/* End of headers */
if (r->source_flags==RD_MIME_STATE_PARTHEADERS)
@ -415,7 +411,6 @@ int rhizome_direct_process_mime_line(rhizome_http_request *r,char *buffer,int co
}
snprintf(filename,1024,"rhizomedirect.%d.%s",r->alarm.poll.fd,field);
filename[1023]=0;
DEBUGF("Writing to '%s'",filename);
r->field_file=fopen(filename,"w");
if (!r->field_file) {
rhizome_direct_clear_temporary_files(r);
@ -438,7 +433,6 @@ int rhizome_direct_process_mime_line(rhizome_http_request *r,char *buffer,int co
(r, 400, "<html><h1>Malformed multi-part form POST: Multiple content-disposition lines in single MIME encoded part.</h1></html>\r\n");
return -1;
}
DEBUGF("Found form part '%s' name '%s'",field,name);
if (!strcasecmp(field,"manifest"))
r->source_flags=RD_MIME_STATE_MANIFESTHEADERS;
if (!strcasecmp(field,"data")) {
@ -467,7 +461,9 @@ int rhizome_direct_process_mime_line(rhizome_http_request *r,char *buffer,int co
}
else {
int written=fwrite(r->request,count,1,r->field_file);
DEBUGF("wrote %d lump of %d bytes",written,count);
if (written<1)
DEBUGF("Short write for multi-part form file -- %d bytes may be missing",
count);
}
break;
}
@ -479,7 +475,6 @@ int rhizome_direct_process_mime_line(rhizome_http_request *r,char *buffer,int co
/* XXX Rewind last two bytes from file if open, and close file */
DEBUGF("Found end of form");
return rhizome_direct_form_received(r);
}
return 0;
@ -489,7 +484,6 @@ int rhizome_direct_process_post_multipart_bytes(rhizome_http_request *r,const ch
{
DEBUG(alloca_toprint(-1, bytes, count));
{
DEBUGF("Saw %d multi-part form bytes",count);
char logname[128];
snprintf(logname,128,"post-%08x.log",r->uuid);
FILE *f=fopen(logname,"a");
@ -560,7 +554,7 @@ int rhizome_direct_process_post_multipart_bytes(rhizome_http_request *r,const ch
r->source_count-=count;
if (r->source_count<=0) {
DEBUGF("Got to end of multi-part form data");
/* Got to end of multi-part form data */
/* If the form is still being processed, then flush things through */
if (r->request_type<0) {

View File

@ -277,7 +277,6 @@ void rhizome_server_poll(struct sched_ent *alarm)
request->uuid=rhizome_http_request_uuid_counter++;
if (peerip) request->requestor=*peerip;
else bzero(&request->requestor,sizeof(request->requestor));
DEBUGF("accepted connection from %s",inet_ntoa(request->requestor.sin_addr));
request->data_file_name[0]=0;
/* We are now trying to read the HTTP request */