- fix a mistake crept in which prevented from setting custom request content type
[m6w6/ext-http] / http_request_object.c
index 46b805a262b9e26746eccbd34408a0b3ad1acd08..3bf2f9871c0556d5be618989d3de579929e4846d 100644 (file)
@@ -450,7 +450,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_
                case HTTP_PUT:
                {
                        php_stream_statbuf ssb;
-                       php_stream *stream = php_stream_open_wrapper(Z_STRVAL_P(GET_PROP(putFile)), "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
+                       php_stream *stream = php_stream_open_wrapper_ex(Z_STRVAL_P(GET_PROP(putFile)), "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL, HTTP_DEFAULT_STREAM_CONTEXT);
                        
                        if (stream && !php_stream_stat(stream, &ssb)) {
                                obj->request->body = http_request_body_init_ex(obj->request->body, HTTP_REQUEST_BODY_UPLOADFILE, stream, ssb.sb.st_size, 1);
@@ -478,7 +478,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_
                                                zval **ct_header;
                                                
                                                /* only override if not already set */
-                                               if ((SUCCESS != zend_hash_find(Z_ARRVAL_PP(headers), "Content-Type", sizeof("Content-Type"), (void **) &ct_header)) && (Z_TYPE_PP(ct_header) == IS_STRING)) {
+                                               if ((SUCCESS != zend_hash_find(Z_ARRVAL_PP(headers), "Content-Type", sizeof("Content-Type"), (void **) &ct_header))) {
                                                        add_assoc_stringl(*headers, "Content-Type", Z_STRVAL_P(ctype), Z_STRLEN_P(ctype), 1);
                                                }
                                        } else {