File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/org/apache/hadoop/tools Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -213,11 +213,17 @@ private function _exec($options, $returnInfo = false)
213213 }
214214 }
215215 if (!$ has_content_length_header && !isset ($ options [CURLOPT_INFILE ]) && !isset ($ options [CURLOPT_INFILESIZE ])) {
216- $ length = 0 ;
217216 if (isset ($ options [CURLOPT_POSTFIELDS ])) {
218- $ length = strlen ($ options [CURLOPT_POSTFIELDS ]);
217+ // only for string content
218+ if (is_string ($ options [CURLOPT_POSTFIELDS ]) && strpos ($ options [CURLOPT_POSTFIELDS ], '@ ' ) !== 0 ) {
219+ $ options [CURLOPT_HTTPHEADER ] = array_merge (
220+ $ options [CURLOPT_HTTPHEADER ],
221+ ['Content-Length: ' .strlen ($ options [CURLOPT_POSTFIELDS ])]
222+ );
223+ }
224+ } else {
225+ $ options [CURLOPT_HTTPHEADER ] = array_merge ($ options [CURLOPT_HTTPHEADER ], ['Content-Length: 0 ' ]);
219226 }
220- $ options [CURLOPT_HTTPHEADER ] = array_merge ($ options [CURLOPT_HTTPHEADER ], ['Content-Length: ' . $ length ]);
221227 }
222228
223229 curl_setopt_array ($ ch , $ options );
You can’t perform that action at this time.
0 commit comments