File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 234234 curl_setopt ( $ ch , CURLOPT_POSTFIELDS , file_get_contents ("php://input " ) );
235235 }
236236
237- if ( $ _GET ['send_cookies ' ] ) {
237+ if ( isset ( $ _GET ['send_cookies ' ]) ) {
238238 $ cookie = array ();
239239 foreach ( $ _COOKIE as $ key => $ value ) {
240240 $ cookie [] = $ key . '= ' . $ value ;
275275 curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true );
276276
277277 curl_setopt ( $ ch , CURLOPT_USERAGENT ,
278- $ _GET ['user_agent ' ] ? $ _GET ['user_agent ' ] : $ _SERVER ['HTTP_USER_AGENT ' ] );
278+ isset ( $ _GET ['user_agent ' ]) ? $ _GET ['user_agent ' ] : $ _SERVER ['HTTP_USER_AGENT ' ] );
279279
280280 list ( $ header , $ contents ) = preg_split ( '/([\r\n][\r\n]) \\1/ ' , curl_exec ( $ ch ), 2 );
281281
300300 }
301301
302302 if ( isset ( $ status ['http_code ' ] ) ) {
303- header ("HTTP/1.1 " .$ status ['http_code ' ]." " .$ status ['status_text ' ]);
304- print $ contents ;
305- exit ();
306- }
303+ $ header = "HTTP/1.1 " .$ status ['http_code ' ];
304+ if (isset ($ status ['status_text ' ])) {
305+ $ header .= " " .$ status ['status_text ' ];
306+ }
307+ header ( $ header );
307308
309+ $ header_match = '/^(?:Content-Type|Content-Language|Set-Cookie)/i ' ;
310+ } else {
311+ $ header_match = '/^(?:HTTP|Content-Type|Content-Language|Set-Cookie)/i ' ;
312+ }
313+
308314 foreach ( $ header_text as $ header ) {
309- if ( preg_match ( ' /^(?:HTTP|Content-Type|Content-Language|Set-Cookie)/i ' , $ header ) ) {
315+ if ( preg_match ( $ header_match , $ header ) ) {
310316 header ( $ header );
311317 }
312318 }
313-
319+
314320 print $ contents ;
315321
316322} else {
You can’t perform that action at this time.
0 commit comments