aboutsummaryrefslogtreecommitdiff
path: root/src/http.c
diff options
context:
space:
mode:
authorgoodale <goodale@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-09-14 21:31:05 +0000
committergoodale <goodale@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-09-14 21:31:05 +0000
commitbf3eeadaddd22d0e06bfd4fec303f9f65d736dc0 (patch)
tree3c53a0f6e661ae3b5a540303c8141e36ef047a7b /src/http.c
parente65d2e8cecbc9435dd2efce1e3647850e3958995 (diff)
Bugfix for catching malformed URIs.
Tom git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@6 1faa4e14-9dd3-4be0-9f0e-ffe519881164
Diffstat (limited to 'src/http.c')
-rw-r--r--src/http.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/http.c b/src/http.c
index ec3ea6f..76797a4 100644
--- a/src/http.c
+++ b/src/http.c
@@ -425,6 +425,7 @@ static int AddHeader(httpRequest *request, const char *line)
/* Strip off leading whitespace */
for(; *value && (*value == ' ' || *value == '\t') ; value++);
+
}
else
{
@@ -520,28 +521,35 @@ static int StripArgs(httpRequest *request, char *request_uri)
do
{
value = strchr(token, '=');
- *value = 0;
+
+ if(value)
+ {
+ *value = 0;
- value++;
+ value++;
- /* Remove any encoding in the token and value */
- Decode(token);
- Decode(value);
+ /* Remove any encoding in the token and value */
+ Decode(token);
+ Decode(value);
- storable = Util_Strdup(value);
+ storable = Util_Strdup(value);
- if(Util_HashData(request->arguments, strlen(token), token, 0))
- {
+ if(Util_HashData(request->arguments, strlen(token), token, 0))
+ {
#ifdef HTTP_DEBUG
- fprintf(stderr, "Ignoring duplicate argument '%s'\n", token);
+ fprintf(stderr, "Ignoring duplicate argument '%s'\n", token);
#endif
+ }
+ else
+ {
+ Util_HashStore(request->arguments, strlen(token), token, 0, (void *)storable);
+ request->n_arguments++;
+ }
}
else
{
- Util_HashStore(request->arguments, strlen(token), token, 0, (void *)storable);
- request->n_arguments++;
- }
-
+ fprintf(stderr, "Argument '%s' has no value !\n", token);
+ }
} while(token=strtok(NULL, "&"));
}
else