]> granicus.if.org Git - libevent/commitdiff
fix an embarassing bug where strchr was used with a cstring instead of a char
authorNiels Provos <provos@gmail.com>
Mon, 6 Aug 2007 20:53:33 +0000 (20:53 +0000)
committerNiels Provos <provos@gmail.com>
Mon, 6 Aug 2007 20:53:33 +0000 (20:53 +0000)
svn:r383

http.c
test/regress_http.c

diff --git a/http.c b/http.c
index 699fd98b0d93641ec15affd58c380de7f3115f1c..2ecf7bdc5ca52b0396da18650e373d348a4b0f0e 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1120,10 +1120,13 @@ int
 evhttp_add_header(struct evkeyvalq *headers,
     const char *key, const char *value)
 {
-       struct evkeyval *header;
+       struct evkeyval *header = NULL;
+
+       event_debug(("%s: key: %s val: %s\n", __func__, key, value));
 
-       if (strchr(value, "\r") != NULL || strchr(value, "\n") != NULL) {
+       if (strchr(value, '\r') != NULL || strchr(value, '\n') != NULL) {
                /* drop illegal headers */
+               event_debug(("%s: dropping illegal header\n"));
                return (-1);
        }
 
index 5c6714c6b25daba5cccf75f119b053dd99fba875..2553ada9206595294e786f4ebb898686f1aa9899 100644 (file)
@@ -517,6 +517,11 @@ http_postrequest_done(struct evhttp_request *req, void *arg)
 {
        const char *what = "This is funny";
 
+       if (req == NULL) {
+               fprintf(stderr, "FAILED (timeout)\n");
+               exit(1);
+       }
+
        if (req->response_code != HTTP_OK) {
        
                fprintf(stderr, "FAILED (response code)\n");