| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2014, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
{
php_http_message_body_t *body = ctx;
- if (body) {
- TSRMLS_FETCH_FROM_CTX(body->ts);
- return php_stream_read(php_http_message_body_stream(body), data, len * n);
+ if (body && body->stream_id) {
+ php_stream *s = php_http_message_body_stream(body);
+
+ if (s) {
+ TSRMLS_FETCH_FROM_CTX(body->ts);
+ return php_stream_read(s, data, len * n);
+ } else abort();
}
return 0;
}
h->progress.info = "blacklist check";
} else if (php_memnstr(data, ZEND_STRL("SSL"), data + length)) {
h->progress.info = "ssl negotiation";
+ } else if (php_memnstr(data, ZEND_STRL("upload"), data + length)) {
+ h->progress.info = "uploaded";
} else if (php_memnstr(data, ZEND_STRL("left intact"), data + length)) {
h->progress.info = "not disconnected";
} else if (php_memnstr(data, ZEND_STRL("closed"), data + length)) {
} else {
#if PHP_DEBUG
h->progress.info = data;
+ data[length - 1] = '\0';
#endif
}
if (h->client->callback.progress.func) {
}
}
php_http_buffer_dtor(&header);
- curl_easy_setopt(curl->handle, CURLOPT_HTTPHEADER, curl->options.headers);
}
+ curl_easy_setopt(curl->handle, CURLOPT_HTTPHEADER, curl->options.headers);
/* attach request body */
if ((body_size = php_http_message_body_size(msg->body))) {
curl_easy_setopt(curl->handle, CURLOPT_READDATA, msg->body);
curl_easy_setopt(curl->handle, CURLOPT_INFILESIZE, body_size);
curl_easy_setopt(curl->handle, CURLOPT_POSTFIELDSIZE, body_size);
+ } else {
+ curl_easy_setopt(curl->handle, CURLOPT_IOCTLDATA, NULL);
+ curl_easy_setopt(curl->handle, CURLOPT_READDATA, NULL);
+ curl_easy_setopt(curl->handle, CURLOPT_INFILESIZE, 0L);
+ curl_easy_setopt(curl->handle, CURLOPT_POSTFIELDSIZE, 0L);
}
php_http_options_apply(&php_http_curle_options, enqueue->options, curl);
/* see http://msdn.microsoft.com/library/en-us/winsock/winsock/windows_sockets_error_codes_2.asp */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "WinSock error: %d", WSAGetLastError());
#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, strerror(errno));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
#endif
return FAILURE;
}