Commit 6f66e1b7 authored by Michael Smith's avatar Michael Smith

bugfixes for httpp_parse_response

svn path=/trunk/httpp/; revision=3834
parent 5a60e7c0
...@@ -162,15 +162,14 @@ int httpp_parse_response(http_parser_t *parser, char *http_data, unsigned long l ...@@ -162,15 +162,14 @@ int httpp_parse_response(http_parser_t *parser, char *http_data, unsigned long l
return 0; return 0;
} }
httpp_setvar(parser, HTTPP_VAR_ERROR_CODE, resp_code);
code = atoi(resp_code); code = atoi(resp_code);
if(code < 200 || code >= 300) { if(code < 200 || code >= 300) {
httpp_setvar(parser, HTTPP_VAR_ERROR_MESSAGE, message); httpp_setvar(parser, HTTPP_VAR_ERROR_MESSAGE, message);
free(data);
return 0;
} }
httpp_setvar(parser, HTTPP_VAR_URI, uri); httpp_setvar(parser, HTTPP_VAR_URI, uri);
httpp_setvar(parser, HTTPP_VAR_REQ_TYPE, "RELAY"); httpp_setvar(parser, HTTPP_VAR_REQ_TYPE, "NONE");
parse_headers(parser, line, lines); parse_headers(parser, line, lines);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define HTTPP_VAR_URI "__uri" #define HTTPP_VAR_URI "__uri"
#define HTTPP_VAR_REQ_TYPE "__req_type" #define HTTPP_VAR_REQ_TYPE "__req_type"
#define HTTPP_VAR_ERROR_MESSAGE "__errormessage" #define HTTPP_VAR_ERROR_MESSAGE "__errormessage"
#define HTTPP_VAR_ERROR_CODE "__errorcode"
typedef enum httpp_request_type_tag { typedef enum httpp_request_type_tag {
httpp_req_none, httpp_req_get, httpp_req_post, httpp_req_head, httpp_req_source, httpp_req_play, httpp_req_stats, httpp_req_unknown httpp_req_none, httpp_req_get, httpp_req_post, httpp_req_head, httpp_req_source, httpp_req_play, httpp_req_stats, httpp_req_unknown
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment