push a load of changes before holidays
[m6w6/ext-http] / php_http_message_body.c
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id: http_message_body.c 292841 2009-12-31 08:48:57Z mike $ */
14
15 #include "php_http.h"
16
17 #include <libgen.h>
18 #include <ext/standard/php_lcg.h>
19 #include <ext/standard/php_string.h>
20
21 #define BOUNDARY_OPEN(body) \
22 do {\
23 size_t size = php_http_message_body_size(body); \
24 if (size) { \
25 php_stream_truncate_set_size(php_http_message_body_stream(body), size - lenof("--" PHP_HTTP_CRLF)); \
26 php_http_message_body_append(body, ZEND_STRL(PHP_HTTP_CRLF)); \
27 } else { \
28 php_http_message_body_appendf(body, "--%s" PHP_HTTP_CRLF, php_http_message_body_boundary(body)); \
29 } \
30 } while(0)
31 #define BOUNDARY_CLOSE(body) \
32 php_http_message_body_appendf(body, PHP_HTTP_CRLF "--%s--" PHP_HTTP_CRLF, php_http_message_body_boundary(body))
33
34 static STATUS add_recursive_fields(php_http_message_body_t *body, const char *name, zval *value);
35 static STATUS add_recursive_files(php_http_message_body_t *body, const char *name, zval *value);
36
37 PHP_HTTP_API php_http_message_body_t *php_http_message_body_init(php_http_message_body_t *body, php_stream *stream TSRMLS_DC)
38 {
39 if (!body) {
40 body = emalloc(sizeof(php_http_message_body_t));
41 }
42 memset(body, 0, sizeof(*body));
43
44 if (stream) {
45 php_stream_auto_cleanup(stream);
46 body->stream_id = php_stream_get_resource_id(stream);
47 zend_list_addref(body->stream_id);
48 } else {
49 stream = php_stream_temp_create(TEMP_STREAM_DEFAULT, 0xffff);
50 php_stream_auto_cleanup(stream);
51 body->stream_id = php_stream_get_resource_id(stream);
52 }
53 TSRMLS_SET_CTX(body->ts);
54
55 return body;
56 }
57
58 PHP_HTTP_API php_http_message_body_t *php_http_message_body_copy(php_http_message_body_t *from, php_http_message_body_t *to, zend_bool dup_internal_stream_and_contents)
59 {
60 if (!from) {
61 return NULL;
62 } else {
63 TSRMLS_FETCH_FROM_CTX(from->ts);
64
65 if (dup_internal_stream_and_contents) {
66 to = php_http_message_body_init(to, NULL TSRMLS_CC);
67 php_http_message_body_to_stream(from, php_http_message_body_stream(to), 0, 0);
68 } else {
69 to = php_http_message_body_init(to, php_http_message_body_stream(from) TSRMLS_CC);
70 }
71
72 if (from->boundary) {
73 to->boundary = estrdup(from->boundary);
74 }
75
76 return to;
77 }
78 }
79
80 PHP_HTTP_API void php_http_message_body_dtor(php_http_message_body_t *body)
81 {
82 /* NO FIXME: shows leakinfo in DEBUG mode */
83 zend_list_delete(body->stream_id);
84 STR_FREE(body->boundary);
85 }
86
87 PHP_HTTP_API void php_http_message_body_free(php_http_message_body_t **body)
88 {
89 if (*body) {
90 php_http_message_body_dtor(*body);
91 efree(*body);
92 *body = NULL;
93 }
94 }
95
96 PHP_HTTP_API php_stream_statbuf *php_http_message_body_stat(php_http_message_body_t *body)
97 {
98 TSRMLS_FETCH_FROM_CTX(body->ts);
99 php_stream_stat(php_http_message_body_stream(body), &body->ssb);
100 return &body->ssb;
101 }
102
103 PHP_HTTP_API const char *php_http_message_body_boundary(php_http_message_body_t *body)
104 {
105 if (!body->boundary) {
106 union { double dbl; int num[2]; } data;
107 TSRMLS_FETCH_FROM_CTX(body->ts);
108
109 data.dbl = php_combined_lcg(TSRMLS_C);
110 spprintf(&body->boundary, 0, "%x.%x", data.num[0], data.num[1]);
111 }
112 return body->boundary;
113 }
114
115 PHP_HTTP_API char *php_http_message_body_etag(php_http_message_body_t *body)
116 {
117 TSRMLS_FETCH_FROM_CTX(body->ts);
118 php_stream_statbuf *ssb = php_http_message_body_stat(body);
119
120 /* real file or temp buffer ? */
121 if (body->ssb.sb.st_mtime) {
122 char *etag;
123
124 spprintf(&etag, 0, "%lx-%lx-%lx", ssb->sb.st_ino, ssb->sb.st_mtime, ssb->sb.st_size);
125 return etag;
126 } else {
127 void *ctx = php_http_etag_init(TSRMLS_C);
128
129 php_http_message_body_to_callback(body, php_http_etag_update, ctx, 0, 0);
130 return php_http_etag_finish(ctx TSRMLS_CC);
131 }
132 }
133
134 PHP_HTTP_API void php_http_message_body_to_string(php_http_message_body_t *body, char **buf, size_t *len, off_t offset, size_t forlen)
135 {
136 TSRMLS_FETCH_FROM_CTX(body->ts);
137 php_stream *s = php_http_message_body_stream(body);
138
139 php_stream_seek(s, offset, SEEK_SET);
140 if (!forlen) {
141 forlen = -1;
142 }
143 *len = php_stream_copy_to_mem(s, buf, forlen, 0);
144 }
145
146 PHP_HTTP_API void php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *dst, off_t offset, size_t forlen)
147 {
148 TSRMLS_FETCH_FROM_CTX(body->ts);
149 php_stream *s = php_http_message_body_stream(body);
150
151 php_stream_seek(s, offset, SEEK_SET);
152 if (!forlen) {
153 forlen = -1;
154 }
155 php_stream_copy_to_stream_ex(s, dst, forlen, NULL);
156 }
157
158 PHP_HTTP_API void php_http_message_body_to_callback(php_http_message_body_t *body, php_http_pass_callback_t cb, void *cb_arg, off_t offset, size_t forlen)
159 {
160 TSRMLS_FETCH_FROM_CTX(body->ts);
161 php_stream *s = php_http_message_body_stream(body);
162
163 php_stream_seek(s, offset, SEEK_SET);
164
165 if (!forlen) {
166 forlen = -1;
167 }
168 while (!php_stream_eof(s)) {
169 char buf[0x1000];
170 size_t read = php_stream_read(s, buf, MIN(forlen, sizeof(buf)));
171
172 if (read) {
173 cb(cb_arg, buf, read);
174 }
175
176 if (read < MIN(forlen, sizeof(buf))) {
177 break;
178 }
179
180 if (forlen && !(forlen -= read)) {
181 break;
182 }
183 }
184 }
185
186 PHP_HTTP_API size_t php_http_message_body_append(php_http_message_body_t *body, const char *buf, size_t len)
187 {
188 php_stream *s;
189 TSRMLS_FETCH_FROM_CTX(body->ts);
190
191 s = php_http_message_body_stream(body);
192 php_stream_seek(s, 0, SEEK_END);
193 return php_stream_write(s, buf, len);
194 }
195
196 PHP_HTTP_API size_t php_http_message_body_appendf(php_http_message_body_t *body, const char *fmt, ...)
197 {
198 va_list argv;
199 char *print_str;
200 size_t print_len;
201
202 va_start(argv, fmt);
203 print_len = vspprintf(&print_str, 0, fmt, argv);
204 va_end(argv);
205
206 print_len = php_http_message_body_append(body, print_str, print_len);
207 efree(print_str);
208
209 return print_len;
210 }
211
212 PHP_HTTP_API STATUS php_http_message_body_add(php_http_message_body_t *body, HashTable *fields, HashTable *files)
213 {
214 zval tmp;
215 TSRMLS_FETCH_FROM_CTX(body->ts);
216
217 if (fields) {
218 INIT_PZVAL_ARRAY(&tmp, fields);
219 if (SUCCESS != add_recursive_fields(body, NULL, &tmp)) {
220 return FAILURE;
221 }
222 }
223 if (files) {
224 INIT_PZVAL_ARRAY(&tmp, files);
225 if (SUCCESS != add_recursive_files(body, NULL, &tmp)) {
226 return FAILURE;
227 }
228 }
229
230 return SUCCESS;
231 }
232
233
234 PHP_HTTP_API STATUS php_http_message_body_add_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len)
235 {
236 char *safe_name = php_addslashes(estrdup(name), strlen(name), NULL, 1 TSRMLS_CC);
237
238 BOUNDARY_OPEN(body);
239 php_http_message_body_appendf(
240 body,
241 "Content-Disposition: form-data; name=\"%s\"" PHP_HTTP_CRLF
242 "" PHP_HTTP_CRLF,
243 safe_name);
244 php_http_message_body_append(body, value_str, value_len);
245 BOUNDARY_CLOSE(body);
246
247 efree(safe_name);
248 return SUCCESS;
249 }
250
251 PHP_HTTP_API STATUS php_http_message_body_add_file(php_http_message_body_t *body, const char *name, const char *path, const char *ctype)
252 {
253 php_stream *in;
254 char *path_dup = estrdup(path);
255 TSRMLS_FETCH_FROM_CTX(body->ts);
256
257 if ((in = php_stream_open_wrapper(path_dup, "r", REPORT_ERRORS|USE_PATH|STREAM_MUST_SEEK, NULL))) {
258 php_stream_statbuf ssb = {{0}};
259
260 if (SUCCESS == php_stream_stat(in, &ssb) && S_ISREG(ssb.sb.st_mode)) {
261 char *safe_name = php_addslashes(estrdup(name), strlen(name), NULL, 1 TSRMLS_CC);
262
263 BOUNDARY_OPEN(body);
264 php_http_message_body_appendf(
265 body,
266 "Content-Disposition: attachment; name=\"%s\"; filename=\"%s\"" PHP_HTTP_CRLF
267 "Content-Type: %s" PHP_HTTP_CRLF
268 "Content-Length: %zu" PHP_HTTP_CRLF
269 "" PHP_HTTP_CRLF,
270 safe_name, basename(path_dup), ctype, ssb.sb.st_size);
271 php_stream_copy_to_stream_ex(in, php_http_message_body_stream(body), PHP_STREAM_COPY_ALL, NULL);
272 BOUNDARY_CLOSE(body);
273
274 efree(safe_name);
275 efree(path_dup);
276 php_stream_close(in);
277 return SUCCESS;
278 } else {
279 efree(path_dup);
280 php_stream_close(in);
281 php_http_error(HE_WARNING, PHP_HTTP_E_MESSAGE_BODY, "Not a valid regular file: %s", path);
282 return FAILURE;
283 }
284 } else {
285 efree(path_dup);
286 return FAILURE;
287 }
288
289 }
290
291 static inline char *format_key(uint type, char *str, ulong num, const char *prefix) {
292 char *new_key = NULL;
293
294 if (prefix && *prefix) {
295 if (type == HASH_KEY_IS_STRING) {
296 spprintf(&new_key, 0, "%s[%s]", prefix, str);
297 } else {
298 spprintf(&new_key, 0, "%s[%lu]", prefix, num);
299 }
300 } else if (type == HASH_KEY_IS_STRING) {
301 new_key = estrdup(str);
302 } else {
303 spprintf(&new_key, 0, "%lu", num);
304 }
305
306 return new_key;
307 }
308
309 static STATUS add_recursive_fields(php_http_message_body_t *body, const char *name, zval *value)
310 {
311 if (Z_TYPE_P(value) == IS_ARRAY || Z_TYPE_P(value) == IS_OBJECT) {
312 zval **val;
313 HashPosition pos;
314 php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
315
316 if (!HASH_OF(value)->nApplyCount) {
317 ++HASH_OF(value)->nApplyCount;
318 FOREACH_KEYVAL(pos, value, key, val) {
319 char *str = format_key(key.type, key.str, key.num, name);
320 if (SUCCESS != add_recursive_fields(body, str, *val)) {
321 efree(str);
322 HASH_OF(value)->nApplyCount--;
323 return FAILURE;
324 }
325 efree(str);
326 }
327 --HASH_OF(value)->nApplyCount;
328 }
329 } else {
330 zval *cpy = php_http_zsep(IS_STRING, value);
331 php_http_message_body_add_field(body, name, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy));
332 zval_ptr_dtor(&cpy);
333 }
334
335 return SUCCESS;
336 }
337
338 static STATUS add_recursive_files(php_http_message_body_t *body, const char *name, zval *value)
339 {
340 if (Z_TYPE_P(value) == IS_ARRAY || Z_TYPE_P(value) == IS_OBJECT) {
341 zval **zfile, **zname, **ztype;
342
343 if ((SUCCESS == zend_hash_find(HASH_OF(value), ZEND_STRS("name"), (void *) &zname))
344 && (SUCCESS == zend_hash_find(HASH_OF(value), ZEND_STRS("file"), (void *) &zfile))
345 && (SUCCESS == zend_hash_find(HASH_OF(value), ZEND_STRS("type"), (void *) &ztype))
346 ) {
347 zval *zfc = php_http_zsep(IS_STRING, *zfile), *znc = php_http_zsep(IS_STRING, *zname), *ztc = php_http_zsep(IS_STRING, *ztype);
348 char *str = format_key(HASH_KEY_IS_STRING, Z_STRVAL_P(znc), 0, name);
349 STATUS ret = php_http_message_body_add_file(body, str, Z_STRVAL_P(zfc), Z_STRVAL_P(ztc));
350
351 efree(str);
352 zval_ptr_dtor(&znc);
353 zval_ptr_dtor(&zfc);
354 zval_ptr_dtor(&ztc);
355
356 if (ret != SUCCESS) {
357 return ret;
358 }
359 } else {
360 zval **val;
361 HashPosition pos;
362 php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
363
364 if (!HASH_OF(value)->nApplyCount) {
365 ++HASH_OF(value)->nApplyCount;
366 FOREACH_KEYVAL(pos, value, key, val) {
367 char *str = format_key(key.type, key.str, key.num, name);
368 if (SUCCESS != add_recursive_files(body, str, *val)) {
369 efree(str);
370 --HASH_OF(value)->nApplyCount;
371 return FAILURE;
372 }
373 efree(str);
374 }
375 --HASH_OF(value)->nApplyCount;
376 }
377 }
378 } else {
379 php_http_error(HE_WARNING, PHP_HTTP_E_MESSAGE_BODY, "Unrecognized array format for message body file to add");
380 return FAILURE;
381 }
382
383 return SUCCESS;
384 }
385
386 /* PHP */
387
388 #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpMessageBody, method, 0, req_args)
389 #define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpMessageBody, method, 0)
390 #define PHP_HTTP_MESSAGE_BODY_ME(method, visibility) PHP_ME(HttpMessageBody, method, PHP_HTTP_ARGS(HttpMessageBody, method), visibility)
391
392 PHP_HTTP_BEGIN_ARGS(__construct, 0)
393 PHP_HTTP_ARG_VAL(stream, 0)
394 PHP_HTTP_END_ARGS;
395
396 PHP_HTTP_EMPTY_ARGS(__toString);
397
398 PHP_HTTP_BEGIN_ARGS(toStream, 1)
399 PHP_HTTP_ARG_VAL(stream, 0)
400 PHP_HTTP_END_ARGS;
401
402 PHP_HTTP_BEGIN_ARGS(toCallback, 1)
403 PHP_HTTP_ARG_VAL(callback, 0)
404 PHP_HTTP_END_ARGS;
405
406 PHP_HTTP_BEGIN_ARGS(append, 1)
407 PHP_HTTP_ARG_VAL(string, 0)
408 PHP_HTTP_END_ARGS;
409
410 PHP_HTTP_BEGIN_ARGS(add, 0)
411 PHP_HTTP_ARG_VAL(fields, 0)
412 PHP_HTTP_ARG_VAL(files, 0)
413 PHP_HTTP_END_ARGS;
414
415
416 zend_class_entry *php_http_message_body_class_entry;
417 zend_function_entry php_http_message_body_method_entry[] = {
418 PHP_HTTP_MESSAGE_BODY_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
419 PHP_HTTP_MESSAGE_BODY_ME(__toString, ZEND_ACC_PUBLIC)
420 PHP_MALIAS(HttpMessageBody, toString, __toString, args_for_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
421 PHP_HTTP_MESSAGE_BODY_ME(toStream, ZEND_ACC_PUBLIC)
422 PHP_HTTP_MESSAGE_BODY_ME(toCallback, ZEND_ACC_PUBLIC)
423 PHP_HTTP_MESSAGE_BODY_ME(append, ZEND_ACC_PUBLIC)
424 PHP_HTTP_MESSAGE_BODY_ME(add, ZEND_ACC_PUBLIC)
425 EMPTY_FUNCTION_ENTRY
426 };
427 static zend_object_handlers php_http_message_body_object_handlers;
428
429 PHP_MINIT_FUNCTION(http_message_body)
430 {
431 PHP_HTTP_REGISTER_CLASS(http\\message, Body, http_message_body, php_http_object_class_entry, 0);
432 php_http_message_body_class_entry->create_object = php_http_message_body_object_new;
433 memcpy(&php_http_message_body_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
434 php_http_message_body_object_handlers.clone_obj = php_http_message_body_object_clone;
435
436 return SUCCESS;
437 }
438
439 zend_object_value php_http_message_body_object_new(zend_class_entry *ce TSRMLS_DC)
440 {
441 return php_http_message_body_object_new_ex(ce, NULL, NULL TSRMLS_CC);
442 }
443
444 zend_object_value php_http_message_body_object_new_ex(zend_class_entry *ce, php_http_message_body_t *body, php_http_message_body_object_t **ptr TSRMLS_DC)
445 {
446 zend_object_value ov;
447 php_http_message_body_object_t *o;
448
449 o = ecalloc(1, sizeof(php_http_message_body_object_t));
450 zend_object_std_init((zend_object *) o, php_http_message_body_class_entry TSRMLS_CC);
451 object_properties_init((zend_object *) o, ce);
452
453 if (ptr) {
454 *ptr = o;
455 }
456
457 if (body) {
458 o->body = body;
459 }
460
461 ov.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_body_object_free, NULL TSRMLS_CC);
462 ov.handlers = &php_http_message_body_object_handlers;
463
464 return ov;
465 }
466
467 zend_object_value php_http_message_body_object_clone(zval *object TSRMLS_DC)
468 {
469 zend_object_value new_ov;
470 php_http_message_body_object_t *new_obj = NULL;
471 php_http_message_body_object_t *old_obj = zend_object_store_get_object(object TSRMLS_CC);
472
473 new_ov = php_http_message_body_object_new_ex(old_obj->zo.ce, php_http_message_body_copy(old_obj->body, NULL, 1), &new_obj);
474 zend_objects_clone_members(&new_obj->zo, new_ov, &old_obj->zo, Z_OBJ_HANDLE_P(object) TSRMLS_CC);
475
476 return new_ov;
477 }
478
479 void php_http_message_body_object_free(void *object TSRMLS_DC)
480 {
481 php_http_message_body_object_t *obj = object;
482
483 php_http_message_body_free(&obj->body);
484
485 zend_object_std_dtor((zend_object *) obj TSRMLS_CC);
486 efree(obj);
487 }
488
489 PHP_METHOD(HttpMessageBody, __construct)
490 {
491 php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
492 zval *zstream = NULL;
493 php_stream *stream;
494
495 with_error_handling(EH_THROW, PHP_HTTP_EX_CE(runtime)) {
496 if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r!", &zstream)) {
497 if (zstream) {
498 php_stream_from_zval(stream, &zstream);
499
500 if (stream) {
501 if (obj->body) {
502 php_http_message_body_dtor(obj->body);
503 }
504 obj->body = php_http_message_body_init(obj->body, stream TSRMLS_CC);
505 }
506 }
507 if (!obj->body) {
508 obj->body = php_http_message_body_init(NULL, NULL TSRMLS_CC);
509 }
510 }
511 } end_error_handling();
512 }
513
514 PHP_METHOD(HttpMessageBody, __toString)
515 {
516 if (SUCCESS == zend_parse_parameters_none()) {
517 php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
518 char *str;
519 size_t len;
520
521 php_http_message_body_to_string(obj->body, &str, &len, 0, 0);
522 if (str) {
523 RETURN_STRINGL(str, len, 0);
524 }
525 }
526 RETURN_EMPTY_STRING();
527 }
528
529 PHP_METHOD(HttpMessageBody, toStream)
530 {
531 zval *zstream;
532 long offset = 0, forlen = 0;
533
534 if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zstream, &offset, &forlen)) {
535 php_stream *stream;
536 php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
537
538 php_stream_from_zval(stream, &zstream);
539 php_http_message_body_to_stream(obj->body, stream, offset, forlen);
540 RETURN_TRUE;
541 }
542 RETURN_FALSE;
543 }
544
545 struct fcd {
546 zval *fcz;
547 zend_fcall_info *fci;
548 zend_fcall_info_cache *fcc;
549 };
550
551 static size_t pass(void *cb_arg, const char *str, size_t len TSRMLS_DC)
552 {
553 struct fcd *fcd = cb_arg;
554 zval *zdata;
555
556 MAKE_STD_ZVAL(zdata);
557 ZVAL_STRINGL(zdata, str, len, 1);
558 if (SUCCESS == zend_fcall_info_argn(fcd->fci TSRMLS_CC, 2, fcd->fcz, zdata)) {
559 zend_fcall_info_call(fcd->fci, fcd->fcc, NULL, NULL TSRMLS_CC);
560 zend_fcall_info_args_clear(fcd->fci, 0);
561 }
562 zval_ptr_dtor(&zdata);
563 return len;
564 }
565
566 PHP_METHOD(HttpMessageBody, toCallback)
567 {
568 struct fcd fcd;
569 long offset = 0, forlen = 0;
570
571 if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f|ll", &fcd.fci, &fcd.fcc, &offset, &forlen)) {
572 php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
573 fcd.fcz = getThis();
574 Z_ADDREF_P(fcd.fcz);
575 php_http_message_body_to_callback(obj->body, pass, &fcd, offset, forlen);
576 zval_ptr_dtor(&fcd.fcz);
577 RETURN_TRUE;
578 }
579 RETURN_FALSE;
580 }
581
582 PHP_METHOD(HttpMessageBody, append)
583 {
584 char *str;
585 int len;
586
587 if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len)) {
588 php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
589
590 RETURN_LONG(php_http_message_body_append(obj->body, str, len));
591 }
592 RETURN_FALSE;
593 }
594
595 PHP_METHOD(HttpMessageBody, add)
596 {
597 HashTable *fields = NULL, *files = NULL;
598
599 if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|hh", &fields, &files)) {
600 php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
601
602 RETURN_SUCCESS(php_http_message_body_add(obj->body, fields, files));
603 }
604 RETURN_FALSE;
605 }
606 /*
607 * Local variables:
608 * tab-width: 4
609 * c-basic-offset: 4
610 * End:
611 * vim600: noet sw=4 ts=4 fdm=marker
612 * vim<600: noet sw=4 ts=4
613 */