Post debugging
FossilOrigin-Name: 138c838089b33777ebb5e987d75e92447c01bb658591757bb4f035826b54b75c
This commit is contained in:
parent
122090e224
commit
4d617fd6a9
1 changed files with 10 additions and 5 deletions
15
src/query.c
15
src/query.c
|
@ -28,6 +28,7 @@ struct query_values post = { 0 };
|
|||
char* read_post_data()
|
||||
{
|
||||
struct http_query_info info;
|
||||
char* post_env = getenv("POST");
|
||||
char* request_method = getenv("REQUEST_METHOD");
|
||||
char* post_query = NULL, *p_query_read;
|
||||
|
||||
|
@ -43,18 +44,22 @@ char* read_post_data()
|
|||
};
|
||||
// END Query references
|
||||
|
||||
if (request_method && (strcmp("POST", request_method) == 0))
|
||||
if ((request_method && (strcmp("POST", request_method) == 0)) || post_env)
|
||||
{
|
||||
int content_length = atoi(getenv("CONTENT_LENGTH"));
|
||||
int content_length = post_env ? strlen(post_env) : atoi(getenv("CONTENT_LENGTH"));
|
||||
post_query = malloc(content_length + 1);
|
||||
if (!post_query)
|
||||
{
|
||||
perror("malloc");
|
||||
return NULL;
|
||||
}
|
||||
// Read in data
|
||||
read(STDIN_FILENO, post_query, content_length);
|
||||
post_query[content_length] = '\0';
|
||||
if (post_env)
|
||||
strcpy(post_query, post_env);
|
||||
else {
|
||||
// Read in data
|
||||
read(STDIN_FILENO, post_query, content_length);
|
||||
post_query[content_length] = '\0';
|
||||
}
|
||||
|
||||
// For shifting through
|
||||
p_query_read = post_query;
|
||||
|
|
Loading…
Reference in a new issue