rhizome direct http manifest-less file import now uses the name

supplied in the HTTP POST form. #9
This commit is contained in:
gardners 2012-10-03 01:34:08 +02:00
parent dc3137707f
commit 636cba8363
2 changed files with 11 additions and 10 deletions

View File

@ -241,17 +241,17 @@ int rhizome_direct_form_received(rhizome_http_request *r)
rhizome_manifest_set_ll(m, "date", (long long) gettime_ms());
if (debug & DEBUG_RHIZOME) DEBUGF("missing 'date', set default date=%s", rhizome_manifest_get(m, "date", NULL, 0));
}
if (strcasecmp(RHIZOME_SERVICE_FILE, service) == 0) {
const char *name = rhizome_manifest_get(m, "name", NULL, 0);
if (name == NULL) {
name = strrchr(filepath, '/');
name = name ? name + 1 : filepath;
rhizome_manifest_set(m, "name", name);
if (debug & DEBUG_RHIZOME) DEBUGF("missing 'name', set default name=\"%s\"", name);
} else {
if (debug & DEBUG_RHIZOME) DEBUGF("manifest contains name=\"%s\"", name);
}
const char *name = rhizome_manifest_get(m, "name", NULL, 0);
if (name == NULL) {
name=r->data_file_name;
rhizome_manifest_set(m, "name", r->data_file_name);
if (debug & DEBUG_RHIZOME) DEBUGF("missing 'name', set name=\"%s\" from HTTP post field filename specification", name);
} 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);
unsigned char authorSid[SID_SIZE];
if (senderhex) fromhexstr(authorSid,senderhex,SID_SIZE);

View File

@ -278,6 +278,7 @@ void rhizome_server_poll(struct sched_ent *alarm)
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 */
request->request_type=RHIZOME_HTTP_REQUEST_RECEIVING;