cvs: pecl /http http_request_api.c php_http_request_api.h

From: Date: Fri, 10 Jun 2005 15:04:14 +0000
Subject: cvs: pecl /http http_request_api.c php_http_request_api.h
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-3257@lists.php.net to get a copy of this message
mike Fri Jun 10 11:04:14 2005 EDT Modified files: /pecl/http http_request_api.c php_http_request_api.h Log: - remove hackish UPLOADDATA code - fix UPLOADFILE handling http://cvs.php.net/diff.php/pecl/http/http_request_api.c?r1=1.13&r2=1.14&ty=u Index: pecl/http/http_request_api.c diff -u pecl/http/http_request_api.c:1.13 pecl/http/http_request_api.c:1.14 --- pecl/http/http_request_api.c:1.13 Fri Jun 10 08:54:44 2005 +++ pecl/http/http_request_api.c Fri Jun 10 11:04:12 2005 @@ -13,7 +13,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: http_request_api.c,v 1.13 2005/06/10 12:54:44 mike Exp $ */ +/* $Id: http_request_api.c,v 1.14 2005/06/10 15:04:12 mike Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -602,7 +602,7 @@ switch (body->type) { case HTTP_REQUEST_BODY_CSTRING: - curl_easy_setopt(ch, CURLOPT_POSTFIELDS, (char *) body->data); + curl_easy_setopt(ch, CURLOPT_POSTFIELDS, body->data); curl_easy_setopt(ch, CURLOPT_POSTFIELDSIZE, body->size); break; @@ -611,8 +611,7 @@ break; case HTTP_REQUEST_BODY_UPLOADFILE: - case HTTP_REQUEST_BODY_UPLOADDATA: - curl_easy_setopt(ch, CURLOPT_READDATA, body); + curl_easy_setopt(ch, CURLOPT_READDATA, http_curl_callback_data(body)); curl_easy_setopt(ch, CURLOPT_INFILESIZE, body->size); break; @@ -1040,40 +1039,10 @@ static char *offset = NULL, *original = NULL; HTTP_CURL_CALLBACK_DATA(s, http_request_body *, body); - switch (body->type) - { - case HTTP_REQUEST_BODY_UPLOADFILE: - { - TSRMLS_FETCH(); - return php_stream_read((php_stream *) body->data, data, len * n); - } - break; - - case HTTP_REQUEST_BODY_UPLOADDATA: - { - size_t avail; - if (original != s) { - original = offset = s; - } - if ((avail = body->size - (offset - original)) < 1) { - return 0; - } - if (avail < (len * n)) { - memcpy(data, offset, avail); - offset += avail; - return avail; - } else { - memcpy(data, offset, len * n); - offset += len * n; - return len * n; - } - } - break; - - default: - return 0; - break; + if (body->type != HTTP_REQUEST_BODY_UPLOADFILE) { + return 0; } + return php_stream_read((php_stream *) body->data, data, len * n); } /* }}} */ http://cvs.php.net/diff.php/pecl/http/php_http_request_api.h?r1=1.9&r2=1.10&ty=u Index: pecl/http/php_http_request_api.h diff -u pecl/http/php_http_request_api.h:1.9 pecl/http/php_http_request_api.h:1.10 --- pecl/http/php_http_request_api.h:1.9 Wed Jun 8 07:14:14 2005 +++ pecl/http/php_http_request_api.h Fri Jun 10 11:04:13 2005 @@ -13,7 +13,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_http_request_api.h,v 1.9 2005/06/08 11:14:14 mike Exp $ */ +/* $Id: php_http_request_api.h,v 1.10 2005/06/10 15:04:13 mike Exp $ */ #ifndef PHP_HTTP_REQUEST_API_H #define PHP_HTTP_REQUEST_API_H @@ -69,7 +69,6 @@ #define HTTP_REQUEST_BODY_CSTRING 1 #define HTTP_REQUEST_BODY_CURLPOST 2 #define HTTP_REQUEST_BODY_UPLOADFILE 3 -#define HTTP_REQUEST_BODY_UPLOADDATA 4 typedef struct { int type; void *data;

« previous php.pecl.cvs (#3257) next »