mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Added boundarystring field to rhizome_http_request structure.
Added call to new (currently stub) function for processing bytes received from a HTTP POST multipart encoded form. #9
This commit is contained in:
parent
8170df7447
commit
ed7edd3865
@ -343,6 +343,8 @@ typedef struct rhizome_http_request {
|
|||||||
the actual processing of the request does not occur while the
|
the actual processing of the request does not occur while the
|
||||||
request headers are still available. */
|
request headers are still available. */
|
||||||
char path[1024];
|
char path[1024];
|
||||||
|
/* Boundary string for POST multipart form requests */
|
||||||
|
char boundarystring[1024];
|
||||||
|
|
||||||
/* The source specification data which are used in different ways by different
|
/* The source specification data which are used in different ways by different
|
||||||
request types */
|
request types */
|
||||||
|
@ -110,6 +110,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||||||
#include "rhizome.h"
|
#include "rhizome.h"
|
||||||
#include "str.h"
|
#include "str.h"
|
||||||
|
|
||||||
|
int rhizome_direct_process_post_multipart_bytes
|
||||||
|
(rhizome_http_request *r,const char *bytes,int count)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int rhizome_direct_parse_http_request(rhizome_http_request *r)
|
int rhizome_direct_parse_http_request(rhizome_http_request *r)
|
||||||
{
|
{
|
||||||
/* Switching to writing, so update the call-back */
|
/* Switching to writing, so update the call-back */
|
||||||
@ -206,11 +212,36 @@ int rhizome_direct_parse_http_request(rhizome_http_request *r)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Remember boundary string and source path */
|
/* Remember boundary string and source path */
|
||||||
snprintf(&r->source[0],1023,"%s",boundary_string);
|
snprintf(&r->boundarystring[0],1023,"%s",boundary_string);
|
||||||
r->source[1023]=0;
|
r->boundarystring[1023]=0;
|
||||||
|
r->source_index=0;
|
||||||
|
r->source_count=cl;
|
||||||
snprintf(&r->path[0],1023,"%s",path);
|
snprintf(&r->path[0],1023,"%s",path);
|
||||||
r->path[1023]=0;
|
r->path[1023]=0;
|
||||||
|
r->request_type=RHIZOME_HTTP_REQUEST_RECEIVING_MULTIPART;
|
||||||
|
|
||||||
|
/* Find the end of the headers and start of any body bytes that we
|
||||||
|
have read so far. */
|
||||||
|
{
|
||||||
|
const char *eoh="\r\n\r\n";
|
||||||
|
int i=0;
|
||||||
|
for(i=0;i<r->request_length;i++) {
|
||||||
|
if (!strncmp(eoh,&r->request[i],strlen(eoh)))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i>=r->request_length) {
|
||||||
|
/* Couldn't find the end of the headers, but this routine should
|
||||||
|
not be called if the end of headers has not been found.
|
||||||
|
Complain and go home. */
|
||||||
|
return
|
||||||
|
rhizome_server_simple_http_response(r, 404, "<html><h1>End of headers seems to have gone missing</h1></html>\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process any outstanding bytes */
|
||||||
|
rhizome_direct_process_post_multipart_bytes(r,&r->request[i],r->request_length-i);
|
||||||
|
r->request_length=0;
|
||||||
|
}
|
||||||
|
|
||||||
return rhizome_server_simple_http_response(r, 200, "<html><h1>Not implemented</h1></html>\r\n");
|
return rhizome_server_simple_http_response(r, 200, "<html><h1>Not implemented</h1></html>\r\n");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user