X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=http_message_object.c;h=235ffc4690cd7b1c89327052937e361410c7ec91;hb=6ecdeac874ee8b45ffa114faa9d1da4850e0a42e;hp=3adbb273e76c523c3ce869aa1ac31ab0293718b8;hpb=b3afcfc70bf06c062115f4994cc04fc8c6e4aa67;p=m6w6%2Fext-http diff --git a/http_message_object.c b/http_message_object.c index 3adbb27..235ffc4 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -886,8 +886,8 @@ PHP_METHOD(HttpMessage, setResponseCode) if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code)) { RETURN_FALSE; } - if (code < 100 || code > 510) { - http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid response code (100-510): %ld", code); + if (code < 100 || code > 599) { + http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid response code (100-599): %ld", code); RETURN_FALSE; } @@ -1278,8 +1278,12 @@ PHP_METHOD(HttpMessage, unserialize) getObject(http_message_object, obj); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &length)) { + http_message *msg; + http_message_dtor(obj->message); - if (!http_message_parse_ex(obj->message, serialized, (size_t) length)) { + if ((msg = http_message_parse_ex(obj->message, serialized, (size_t) length))) { + obj->message = msg; + } else { http_error(HE_ERROR, HTTP_E_RUNTIME, "Could not unserialize HttpMessage"); http_message_init(obj->message); }