From 3c9f76acbd25f6f9d656736cf7b376ef8b4869c1 Mon Sep 17 00:00:00 2001 From: asterix Date: Tue, 4 Oct 2011 13:34:04 +0000 Subject: [PATCH] Clean up. Return error also when we don't found key in query string. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5141 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/net/http.c | 6 +++--- bertos/net/http.h | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bertos/net/http.c b/bertos/net/http.c index 2ea10044..f15af4d7 100644 --- a/bertos/net/http.c +++ b/bertos/net/http.c @@ -97,13 +97,13 @@ int http_getValue(char *tolenized_buf, size_t tolenized_buf_len, const char *key return -1; strcpy(value, decoded_str); - break; + return value_len; } /* jump to next pair */ p += token_len + 1; } - return value_len; + return -1; } /** @@ -250,7 +250,7 @@ static http_handler_t cgi_search(const char *name, HttpCGI *table) int i = 0; const char *ext = get_ext(name); - LOG_INFO("EXT %s\n", ext); + LOG_INFO("EXT %s\n", ext ? "none" : ext); while(table[i].name) { if (ext && table[i].type == CGI_MATCH_EXT) diff --git a/bertos/net/http.h b/bertos/net/http.h index 4395f1ee..b03b93b2 100644 --- a/bertos/net/http.h +++ b/bertos/net/http.h @@ -59,8 +59,6 @@ typedef struct HttpCGI #define CGI_MATCH_EXT 2 ///< Select item in table if the extention match #define CGI_MATCH_NAME 3 ///< Select item in table if the string is content -#define HTTP_MAX_GET_TOKENS 5 - int http_getValue(char *tolenized_buf, size_t tolenized_buf_len, const char *key, char *value, size_t len); int http_tokenizeGetRequest(char *raw_buf, size_t raw_len); void http_getPageName(const char *recv_buf, size_t recv_len, char *page_name, size_t len); -- 2.25.1