diff --git a/rhizome_http.c b/rhizome_http.c
index 655fe34a..58ca835d 100644
--- a/rhizome_http.c
+++ b/rhizome_http.c
@@ -545,8 +545,42 @@ int rhizome_server_parse_http_request(rhizome_http_request *r)
} else if (str_startswith(path, "/rhizome/manifest/", &id)) {
// TODO: Stream the specified manifest
rhizome_server_simple_http_response(r, 500, "
Not implemented
\r\n");
- } else {
+ } else if (str_startswith(path, "/rhizome/manifestbyprefix/", &id)) {
+ /* Manifest by prefix */
+ char bid_low[RHIZOME_MANIFEST_ID_STRLEN+1];
+ char bid_high[RHIZOME_MANIFEST_ID_STRLEN+1];
+ int i;
+ for (i=0;i= 0 && sqlite3_blob_open(rhizome_db, "main", "manifests", "manifest", rowid, 0, &r->blob) != SQLITE_OK)
+ rowid = -1;
+ if (rowid == -1) {
+ DEBUGF("Row not found");
+ rhizome_server_simple_http_response(r, 404, "Payload not found
\r\n");
+ } else {
+ DEBUGF("row id = %d",rowid);
+ r->source_index = 0;
+ r->blob_end = sqlite3_blob_bytes(r->blob);
+ rhizome_server_http_response_header(r, 200, "application/binary", r->blob_end - r->source_index);
+ r->request_type |= RHIZOME_HTTP_REQUEST_BLOB;
+ }
+ }else {
rhizome_server_simple_http_response(r, 404, "Not found
\r\n");
+ DEBUGF("Sending 404 not found for '%s'",path);
}
} else {
if (debug & DEBUG_RHIZOME_TX)