summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-27 00:04:24 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-27 00:04:24 -0400
commitc1bb197f7357738f748e141a844660ef5340bbf4 (patch)
tree81f4941d046788f5e0b654557ce295384a0ba372
parent1baa78dab630530cabe06ca0d48ac3ab2b30a0f7 (diff)
downloadlibfhp-c1bb197f7357738f748e141a844660ef5340bbf4.tar.bz2
libfhp-c1bb197f7357738f748e141a844660ef5340bbf4.zip
add more invalid character errors, clean up comments
-rw-r--r--fhp.c18
-rw-r--r--include/fhp/fhp.h2
2 files changed, 11 insertions, 9 deletions
diff --git a/fhp.c b/fhp.c
index eb0a7ae..70a3858 100644
--- a/fhp.c
+++ b/fhp.c
@@ -180,6 +180,8 @@ fhp_errors[] = {
"invalid character in HTTP URL",
"invalid percent-encoded character in HTTP URL",
"invalid character in HTTP version",
+ "invalid character after carriage return",
+ "invalid character in HTTP header name",
"invalid error code",
"buffer too small",
};
@@ -506,7 +508,8 @@ retry:
break;
default:
- // never reached
+ // invalid character
+ // (should never be reached)
return FHP_ERR_INVALID_CHAR;
};
@@ -518,13 +521,11 @@ retry:
break;
default:
- // FIXME: invalid character
- return FHP_ERR_INVALID_CHAR;
+ return FHP_ERR_INVALID_CHAR_AFTER_CR;
};
break;
case FHP_STATE_STATUS_END:
- // TODO
switch (byte) {
CASE_TOKEN_CHARS
// send start token
@@ -557,8 +558,7 @@ retry:
break;
default:
- // FIXME: invalid character
- return FHP_ERR_INVALID_CHAR;
+ return FHP_ERR_INVALID_CHAR_AFTER_CR;
}
break;
@@ -584,8 +584,7 @@ retry:
break;
default:
- // FIXME: invalid character
- return FHP_ERR_INVALID_CHAR;
+ return FHP_ERR_INVALID_CHAR_IN_HEADER_NAME;
}
break;
@@ -719,7 +718,8 @@ retry:
break;
default:
- // FIXME: invalid state
+ // invalid state
+ // (should never be reached)
return FHP_ERR_BAD_STATE;
}
diff --git a/include/fhp/fhp.h b/include/fhp/fhp.h
index 72df8a5..563d2ad 100644
--- a/include/fhp/fhp.h
+++ b/include/fhp/fhp.h
@@ -14,6 +14,8 @@ typedef enum {
FHP_ERR_INVALID_CHAR_IN_URL,
FHP_ERR_INVALID_CHAR_IN_URL_PERCENT,
FHP_ERR_INVALID_CHAR_IN_VERSION,
+ FHP_ERR_INVALID_CHAR_AFTER_CR,
+ FHP_ERR_INVALID_CHAR_IN_HEADER_NAME,
FHP_ERR_INVALID_ERROR,
FHP_ERR_BUFFER_TOO_SMALL,
FHP_ERR_LAST