X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_request_object.c;h=7b1d82bec99ac92b1c4d3a909bea9d8f87a041af;hp=cbb8b2be93b0810b521c174a54b9c597021b8898;hb=dd579c42c06ebfe26ea2ff8ee6106a22d27e3340;hpb=a896cda2c56ae9525e8d99622841350a1fb73926 diff --git a/http_request_object.c b/http_request_object.c index cbb8b2b..7b1d82b 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -424,10 +424,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ if (!body) { return FAILURE; } - if ((!obj->ch) && (!(obj->ch = curl_easy_init()))) { - http_error(HE_WARNING, HTTP_E_REQUEST, "Could not initilaize curl"); - return FAILURE; - } + HTTP_CHECK_CURL_INIT(obj->ch, curl_easy_init(), return FAILURE); URL = convert_to_type_ex(IS_STRING, GET_PROP(obj, url)); // HTTP_URI_MAXLEN+1 long char * @@ -1033,11 +1030,7 @@ PHP_METHOD(HttpRequest, setContentType) RETURN_FALSE; } - if (!strchr(ctype, '/')) { - http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Content-Type '%s' doesn't seem to contain a primary and a secondary part", ctype); - RETURN_FALSE; - } - + HTTP_CHECK_CONTENT_TYPE(ctype, RETURN_FALSE); UPD_STRL(obj, contentType, ctype, ct_len); RETURN_TRUE; } @@ -1341,10 +1334,7 @@ PHP_METHOD(HttpRequest, addPostFile) } if (type_len) { - if (!strchr(type, '/')) { - http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Content-Type '%s' doesn't seem to contain a primary and a secondary part", type); - RETURN_FALSE; - } + HTTP_CHECK_CONTENT_TYPE(type, RETURN_FALSE); } else { type = "application/x-octetstream"; type_len = sizeof("application/x-octetstream") - 1;