char *_http_pretty_key(char *key, size_t key_len, zend_bool uctitle, zend_bool xhyphen)
{
if (key && key_len) {
- unsigned i, wasalpha;
- if (wasalpha = isalpha(key[0])) {
- key[0] = uctitle ? toupper(key[0]) : tolower(key[0]);
+ size_t i;
+ int wasalpha;
+ if (wasalpha = isalpha((int) key[0])) {
+ key[0] = (char) (uctitle ? toupper((int) key[0]) : tolower((int) key[0]));
}
for (i = 1; i < key_len; i++) {
- if (isalpha(key[i])) {
- key[i] = ((!wasalpha) && uctitle) ? toupper(key[i]) : tolower(key[i]);
+ if (isalpha((int) key[i])) {
+ key[i] = (char) (((!wasalpha) && uctitle) ? toupper((int) key[i]) : tolower((int) key[i]));
wasalpha = 1;
} else {
if (xhyphen && (key[i] == '_')) {
HTTP_GSC(zauth, "HTTP_AUTHORIZATION", FAILURE);
{
int decoded_len;
- char *colon, *decoded = php_base64_decode(Z_STRVAL_P(zauth), Z_STRLEN_P(zauth), &decoded_len);
+ char *colon, *decoded = (char *) php_base64_decode((const unsigned char *) Z_STRVAL_P(zauth), Z_STRLEN_P(zauth), &decoded_len);
if (colon = strchr(decoded + 6, ':')) {
*user = estrndup(decoded + 6, colon - decoded - 6);
size_t query_len = 0;
zend_bool session = 0, permanent = 0;
zval *params = NULL;
- char *query, *url, *URI,
+ char *query = NULL, *url = NULL, *URI,
LOC[HTTP_URI_MAXLEN + sizeof("Location: ")],
RED[HTTP_URI_MAXLEN * 2 + sizeof("Redirecting to <a href=\"%s?%s\">%s?%s</a>.\n")];
PHP_HTTP_API void _http_get_request_headers_ex(HashTable *headers, zend_bool prettify TSRMLS_DC)
{
char *key = NULL;
- long idx = 0;
+ ulong idx = 0;
zval array;
Z_ARRVAL(array) = headers;
// response
if (!strncmp(http_line, "HTTP/1.", lenof("HTTP/1."))) {
new->type = HTTP_MSG_RESPONSE;
- new->info.response.http_version = (float) atof(http_line + lenof("HTTP/"));
+ new->info.response.http_version = atof(http_line + lenof("HTTP/"));
new->info.response.code = atoi(http_line + lenof("HTTP/1.1 "));
} else
// request
if (!strncmp(http_line + line_length - lenof("HTTP/1.1"), "HTTP/1.", lenof("HTTP/1."))) {
const char *method_sep_uri = strchr(http_line, ' ');
new->type = HTTP_MSG_REQUEST;
- new->info.request.http_version = (float) atof(http_line + line_length - lenof("1.1"));
+ new->info.request.http_version = atof(http_line + line_length - lenof("1.1"));
new->info.request.method = estrndup(http_line, method_sep_uri - http_line);
new->info.request.URI = estrndup(method_sep_uri + 1, http_line + line_length - method_sep_uri - 1 - lenof(" HTTP/1.1"));
}
switch (msg->type)
{
case HTTP_MSG_REQUEST:
- msg->info.request.http_version = (float) Z_DVAL_P(value);
+ msg->info.request.http_version = Z_DVAL_P(value);
break;
case HTTP_MSG_RESPONSE:
- msg->info.response.http_version = (float) Z_DVAL_P(value);
+ msg->info.response.http_version = Z_DVAL_P(value);
break;
}
break;
PHP_METHOD(HttpRequest, setOptions)
{
char *key = NULL;
- long idx = 0;
+ ulong idx = 0;
zval *opts, *old_opts, **opt;
getObject(http_request_object, obj);
/* {{{ void http_request_data_free_string(char **) */
void _http_request_data_free_string(void *string)
{
- //fprintf(stderr, "FREE STRING %p (%s)\n", *((char **)string), *((char **)string));
efree(*((char **)string));
}
/* }}} */
/* {{{ static size_t http_curl_read_callback(void *, size_t, size_t, void *) */
static size_t http_curl_read_callback(void *data, size_t len, size_t n, void *s)
{
- static char *offset = NULL, *original = NULL;
HTTP_CURL_CALLBACK_DATA(s, http_request_body *, body);
if (body->type != HTTP_REQUEST_BODY_UPLOADFILE) {
union {
struct {
- float http_version;
+ double http_version;
char *method;
char *URI;
} request;