added extra field to rhizome http request structure and update

rhizome direct code to remember the path in a multipart form post
operation, and also the boundary string that will separate the
parts.
This commit is contained in:
gardners 2012-08-31 13:15:05 +09:30
parent 211f75cb53
commit 8170df7447
2 changed files with 21 additions and 1 deletions

View File

@ -314,7 +314,10 @@ typedef struct rhizome_http_request {
/* Nature of the request */
int request_type;
/* All of the below are receiving data */
#define RHIZOME_HTTP_REQUEST_RECEIVING -1
#define RHIZOME_HTTP_REQUEST_RECEIVING_MULTIPART -2
/* All of the below are sending data */
#define RHIZOME_HTTP_REQUEST_FROMBUFFER 1
#define RHIZOME_HTTP_REQUEST_FILE 2
#define RHIZOME_HTTP_REQUEST_SUBSCRIBEDGROUPLIST 4
@ -336,6 +339,11 @@ typedef struct rhizome_http_request {
int buffer_length; // number of bytes loaded into buffer
int buffer_offset; // where we are between [0,buffer_length)
/* Path of request (used by POST multipart form requests where
the actual processing of the request does not occur while the
request headers are still available. */
char path[1024];
/* The source specification data which are used in different ways by different
request types */
char source[1024];

View File

@ -196,9 +196,21 @@ int rhizome_direct_parse_http_request(rhizome_http_request *r)
DEBUGF("HTTP POST content-length=%lld, boundary string='%s'",
cl,boundary_string);
/* Now start receiving and parsing multi-part data.
We may have already received some of the post-header data, so
rewind that if necessary. */
rewind that if necessary. Need to start by finding actual end of
headers, and passing any body bytes to the parser.
Also need to tell the HTTP request that it has moved to multipart
form data parsing, and what the actual requested action is.
*/
/* Remember boundary string and source path */
snprintf(&r->source[0],1023,"%s",boundary_string);
r->source[1023]=0;
snprintf(&r->path[0],1023,"%s",path);
r->path[1023]=0;
return rhizome_server_simple_http_response(r, 200, "<html><h1>Not implemented</h1></html>\r\n");
} else {