Changeset 3191
- Timestamp:
- 11/22/05 01:14:26 (3 years ago)
- Files:
-
- trunk/wp-includes/class-snoopy.php (modified) (34 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/class-snoopy.php
r2053 r3191 6 6 Author: Monte Ohrt <monte@ispi.net> 7 7 Copyright (c): 1999-2000 ispi, all rights reserved 8 Version: 1.0 8 Version: 1.01 9 9 10 10 * This library is free software; you can redistribute it and/or … … 32 32 33 33 The latest version of Snoopy can be obtained from: 34 http://snoopy.sourceforge.net 34 http://snoopy.sourceforge.net/ 35 35 36 36 *************************************************/ … … 47 47 var $proxy_host = ""; // proxy host to use 48 48 var $proxy_port = ""; // proxy port to use 49 var $agent = "Snoopy v1.0"; // agent we masquerade as 49 var $proxy_user = ""; // proxy user to use 50 var $proxy_pass = ""; // proxy password to use 51 52 var $agent = "Snoopy v1.2.3"; // agent we masquerade as 50 53 var $referer = ""; // referer info to pass 51 54 var $cookies = array(); // array of cookies to pass … … 60 63 var $expandlinks = true; // expand links to fully qualified URLs. 61 64 // this only applies to fetchlinks() 62 // or submitlinks()65 // submitlinks(), and submittext() 63 66 var $passcookies = true; // pass set cookies back through redirects 64 67 // NOTE: this currently does not respect … … 82 85 var $timed_out = false; // if a read operation timed out 83 86 var $status = 0; // http request status 84 85 var $curl_path = "/usr/bin/curl"; 87 88 var $temp_dir = "/tmp"; // temporary directory that the webserver 89 // has permission to write to. 90 // under Windows, this should be C:\temp 91 92 var $curl_path = "/usr/local/bin/curl"; 86 93 // Snoopy will use cURL for fetching 87 94 // SSL content if a full system path to … … 95 102 // as of this Snoopy release. 96 103 97 // send Accept-encoding: gzip?98 var $use_gzip = true;99 100 104 /**** Private variables ****/ 101 105 … … 133 137 if (!empty($URI_PARTS["pass"])) 134 138 $this->pass = $URI_PARTS["pass"]; 139 if (empty($URI_PARTS["query"])) 140 $URI_PARTS["query"] = ''; 141 if (empty($URI_PARTS["path"])) 142 $URI_PARTS["path"] = ''; 135 143 136 switch( $URI_PARTS["scheme"])144 switch(strtolower($URI_PARTS["scheme"])) 137 145 { 138 146 case "http": … … 149 157 else 150 158 { 151 $path = $URI_PARTS["path"].( isset($URI_PARTS["query"])? "?".$URI_PARTS["query"] : "");159 $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); 152 160 // no proxy, send only the path 153 161 $this->_httprequest($path, $fp, $URI, $this->_httpmethod); … … 196 204 break; 197 205 case "https": 198 if(!$this->curl_path || (!is_executable($this->curl_path))) { 199 $this->error = "Bad curl ($this->curl_path), can't fetch HTTPS \n"; 206 if(!$this->curl_path) 200 207 return false; 201 } 208 if(function_exists("is_executable")) 209 if (!is_executable($this->curl_path)) 210 return false; 202 211 $this->host = $URI_PARTS["host"]; 203 212 if(!empty($URI_PARTS["port"])) … … 258 267 } 259 268 260 269 /*======================================================================*\ 270 Function: submit 271 Purpose: submit an http form 272 Input: $URI the location to post the data 273 $formvars the formvars to use. 274 format: $formvars["var"] = "val"; 275 $formfiles an array of files to submit 276 format: $formfiles["var"] = "/dir/filename.ext"; 277 Output: $this->results the text output from the post 278 \*======================================================================*/ 279 280 function submit($URI, $formvars="", $formfiles="") 281 { 282 unset($postdata); 283 284 $postdata = $this->_prepare_post_body($formvars, $formfiles); 285 286 $URI_PARTS = parse_url($URI); 287 if (!empty($URI_PARTS["user"])) 288 $this->user = $URI_PARTS["user"]; 289 if (!empty($URI_PARTS["pass"])) 290 $this->pass = $URI_PARTS["pass"]; 291 if (empty($URI_PARTS["query"])) 292 $URI_PARTS["query"] = ''; 293 if (empty($URI_PARTS["path"])) 294 $URI_PARTS["path"] = ''; 295 296 switch(strtolower($URI_PARTS["scheme"])) 297 { 298 case "http": 299 $this->host = $URI_PARTS["host"]; 300 if(!empty($URI_PARTS["port"])) 301 $this->port = $URI_PARTS["port"]; 302 if($this->_connect($fp)) 303 { 304 if($this->_isproxy) 305 { 306 // using proxy, send entire URI 307 $this->_httprequest($URI,$fp,$URI,$this->_submit_method,$this->_submit_type,$postdata); 308 } 309 else 310 { 311 $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); 312 // no proxy, send only the path 313 $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); 314 } 315 316 $this->_disconnect($fp); 317 318 if($this->_redirectaddr) 319 { 320 /* url was redirected, check if we've hit the max depth */ 321 if($this->maxredirs > $this->_redirectdepth) 322 { 323 if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) 324 $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); 325 326 // only follow redirect if it's on this site, or offsiteok is true 327 if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) 328 { 329 /* follow the redirect */ 330 $this->_redirectdepth++; 331 $this->lastredirectaddr=$this->_redirectaddr; 332 if( strpos( $this->_redirectaddr, "?" ) > 0 ) 333 $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get 334 else 335 $this->submit($this->_redirectaddr,$formvars, $formfiles); 336 } 337 } 338 } 339 340 if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) 341 { 342 $frameurls = $this->_frameurls; 343 $this->_frameurls = array(); 344 345 while(list(,$frameurl) = each($frameurls)) 346 { 347 if($this->_framedepth < $this->maxframes) 348 { 349 $this->fetch($frameurl); 350 $this->_framedepth++; 351 } 352 else 353 break; 354 } 355 } 356 357 } 358 else 359 { 360 return false; 361 } 362 return true; 363 break; 364 case "https": 365 if(!$this->curl_path) 366 return false; 367 if(function_exists("is_executable")) 368 if (!is_executable($this->curl_path)) 369 return false; 370 $this->host = $URI_PARTS["host"]; 371 if(!empty($URI_PARTS["port"])) 372 $this->port = $URI_PARTS["port"]; 373 if($this->_isproxy) 374 { 375 // using proxy, send entire URI 376 $this->_httpsrequest($URI, $URI, $this->_submit_method, $this->_submit_type, $postdata); 377 } 378 else 379 { 380 $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); 381 // no proxy, send only the path 382 $this->_httpsrequest($path, $URI, $this->_submit_method, $this->_submit_type, $postdata); 383 } 384 385 if($this->_redirectaddr) 386 { 387 /* url was redirected, check if we've hit the max depth */ 388 if($this->maxredirs > $this->_redirectdepth) 389 { 390 if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) 391 $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); 392 393 // only follow redirect if it's on this site, or offsiteok is true 394 if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) 395 { 396 /* follow the redirect */ 397 $this->_redirectdepth++; 398 $this->lastredirectaddr=$this->_redirectaddr; 399 if( strpos( $this->_redirectaddr, "?" ) > 0 ) 400 $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get 401 else 402 $this->submit($this->_redirectaddr,$formvars, $formfiles); 403 } 404 } 405 } 406 407 if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) 408 { 409 $frameurls = $this->_frameurls; 410 $this->_frameurls = array(); 411 412 while(list(,$frameurl) = each($frameurls)) 413 { 414 if($this->_framedepth < $this->maxframes) 415 { 416 $this->fetch($frameurl); 417 $this->_framedepth++; 418 } 419 else 420 break; 421 } 422 } 423 return true; 424 break; 425 426 default: 427 // not a valid protocol 428 $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; 429 return false; 430 break; 431 } 432 return true; 433 } 434 435 /*======================================================================*\ 436 Function: fetchlinks 437 Purpose: fetch the links from a web page 438 Input: $URI where you are fetching from 439 Output: $this->results an array of the URLs 440 \*======================================================================*/ 441 442 function fetchlinks($URI) 443 { 444 if ($this->fetch($URI)) 445 { 446 if($this->lastredirectaddr) 447 $URI = $this->lastredirectaddr; 448 if(is_array($this->results)) 449 { 450 for($x=0;$x<count($this->results);$x++) 451 $this->results[$x] = $this->_striplinks($this->results[$x]); 452 } 453 else 454 $this->results = $this->_striplinks($this->results); 455 456 if($this->expandlinks) 457 $this->results = $this->_expandlinks($this->results, $URI); 458 return true; 459 } 460 else 461 return false; 462 } 463 464 /*======================================================================*\ 465 Function: fetchform 466 Purpose: fetch the form elements from a web page 467 Input: $URI where you are fetching from 468 Output: $this->results the resulting html form 469 \*======================================================================*/ 470 471 function fetchform($URI) 472 { 473 474 if ($this->fetch($URI)) 475 { 476 477 if(is_array($this->results)) 478 { 479 for($x=0;$x<count($this->results);$x++) 480 $this->results[$x] = $this->_stripform($this->results[$x]); 481 } 482 else 483 $this->results = $this->_stripform($this->results); 484 485 return true; 486 } 487 else 488 return false; 489 } 490 491 492 /*======================================================================*\ 493 Function: fetchtext 494 Purpose: fetch the text from a web page, stripping the links 495 Input: $URI where you are fetching from 496 Output: $this->results the text from the web page 497 \*======================================================================*/ 498 499 function fetchtext($URI) 500 { 501 if($this->fetch($URI)) 502 { 503 if(is_array($this->results)) 504 { 505 for($x=0;$x<count($this->results);$x++) 506 $this->results[$x] = $this->_striptext($this->results[$x]); 507 } 508 else 509 $this->results = $this->_striptext($this->results); 510 return true; 511 } 512 else 513 return false; 514 } 515 516 /*======================================================================*\ 517 Function: submitlinks 518 Purpose: grab links from a form submission 519 Input: $URI where you are submitting from 520 Output: $this->results an array of the links from the post 521 \*======================================================================*/ 522 523 function submitlinks($URI, $formvars="", $formfiles="") 524 { 525 if($this->submit($URI,$formvars, $formfiles)) 526 { 527 if($this->lastredirectaddr) 528 $URI = $this->lastredirectaddr; 529 if(is_array($this->results)) 530 { 531 for($x=0;$x<count($this->results);$x++) 532 { 533 $this->results[$x] = $this->_striplinks($this->results[$x]); 534 if($this->expandlinks) 535 $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); 536 } 537 } 538 else 539 { 540 $this->results = $this->_striplinks($this->results); 541 if($this->expandlinks) 542 $this->results = $this->_expandlinks($this->results,$URI); 543 } 544 return true; 545 } 546 else 547 return false; 548 } 549 550 /*======================================================================*\ 551 Function: submittext 552 Purpose: grab text from a form submission 553 Input: $URI where you are submitting from 554 Output: $this->results the text from the web page 555 \*======================================================================*/ 556 557 function submittext($URI, $formvars = "", $formfiles = "") 558 { 559 if($this->submit($URI,$formvars, $formfiles)) 560 { 561 if($this->lastredirectaddr) 562 $URI = $this->lastredirectaddr; 563 if(is_array($this->results)) 564 { 565 for($x=0;$x<count($this->results);$x++) 566 { 567 $this->results[$x] = $this->_striptext($this->results[$x]); 568 if($this->expandlinks) 569 $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); 570 } 571 } 572 else 573 { 574 $this->results = $this->_striptext($this->results); 575 if($this->expandlinks) 576 $this->results = $this->_expandlinks($this->results,$URI); 577 } 578 return true; 579 } 580 else 581 return false; 582 } 583 584 585 586 /*======================================================================*\ 587 Function: set_submit_multipart 588 Purpose: Set the form submission content type to 589 multipart/form-data 590 \*======================================================================*/ 591 function set_submit_multipart() 592 { 593 $this->_submit_type = "multipart/form-data"; 594 } 595 596 597 /*======================================================================*\ 598 Function: set_submit_normal 599 Purpose: Set the form submission content type to 600 application/x-www-form-urlencoded 601 \*======================================================================*/ 602 function set_submit_normal() 603 { 604 $this->_submit_type = "application/x-www-form-urlencoded"; 605 } 606 607 608 261 609 262 610 /*======================================================================*\ … … 274 622 function _striplinks($document) 275 623 { 276 preg_match_all("'<\s*a\s +.*href\s*=\s* # find <a href=624 preg_match_all("'<\s*a\s.*?href\s*=\s* # find <a href= 277 625 ([\"\'])? # find single or double quote 278 626 (?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching … … 336 684 "'<[\/\!]*?[^<>]*?>'si", // strip out html tags 337 685 "'([\r\n])[\s]+'", // strip out white space 338 "'&(quot e|#34);'i",// replace html entities339 "'&(amp|#38 );'i",340 "'&(lt|#60 );'i",341 "'&(gt|#62 );'i",342 "'&(nbsp|#160 );'i",686 "'&(quot|#34|#034|#x22);'i", // replace html entities 687 "'&(amp|#38|#038|#x26);'i", // added hexadecimal values 688 "'&(lt|#60|#060|#x3c);'i", 689 "'&(gt|#62|#062|#x3e);'i", 690 "'&(nbsp|#160|#xa0);'i", 343 691 "'&(iexcl|#161);'i", 344 692 "'&(cent|#162);'i", 345 693 "'&(pound|#163);'i", 346 "'&(copy|#169);'i" 347 ); 694 "'&(copy|#169);'i", 695 "'&(reg|#174);'i", 696 "'&(deg|#176);'i", 697 "'&(#39|#039|#x27);'", 698 "'&(euro|#8364);'i", // europe 699 "'&a(uml|UML);'", // german 700 "'&o(uml|UML);'", 701 "'&u(uml|UML);'", 702 "'&A(uml|UML);'", 703 "'&O(uml|UML);'", 704 "'&U(uml|UML);'", 705 "'ß'i", 706 ); 348 707 $replace = array( "", 349 708 "", … … 357 716 chr(162), 358 717 chr(163), 359 chr(169)); 718 chr(169), 719 chr(174), 720 chr(176), 721 chr(39), 722 chr(128), 723 "� 724 "� "� "�, 725 "�, 726 "�, 727 "�, 728 ); 360 729 361 730 $text = preg_replace($search,$replace,$document); … … 378 747 379 748 $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]); 749 $match = preg_replace("|/$|","",$match); 750 $match_part = parse_url($match); 751 $match_root = 752 $match_part["scheme"]."://".$match_part["host"]; 380 753 381 754 $search = array( "|^http://".preg_quote($this->host)."|i", 382 "|^(?!http://)(\/)?(?!mailto:)|i", 755 "|^(\/)|i", 756 "|^(?!http://)(?!mailto:)|i", 383 757 "|/\./|", 384 758 "|/[^\/]+/\.\./|" … … 386 760 387 761 $replace = array( "", 762 $match_root."/", 388 763 $match."/", 389 764 "/", … … 408 783 function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") 409 784 { 785 $cookie_headers = ''; 410 786 if($this->passcookies && $this->_redirectaddr) 411 787 $this->setcookies(); … … 417 793 if(!empty($this->agent)) 418 794 $headers .= "User-Agent: ".$this->agent."\r\n"; 419 if(!empty($this->host) && !isset($this->rawheaders['Host'])) 420 $headers .= "Host: ".$this->host."\r\n"; 795 if(!empty($this->host) && !isset($this->rawheaders['Host'])) { 796 $headers .= "Host: ".$this->host; 797 if(!empty($this->port)) 798 $headers .= ":".$this->port; 799 $headers .= "\r\n"; 800 } 421 801 if(!empty($this->accept)) 422 802 $headers .= "Accept: ".$this->accept."\r\n"; 423 424 if($this->use_gzip) {425 // make sure PHP was built with --with-zlib426 // and we can handle gzipp'ed data427 if ( function_exists(gzinflate) ) {428 $headers .= "Accept-encoding: gzip\r\n";429 }430 else {431 trigger_error(432 "use_gzip is on, but PHP was built without zlib support.".433 " Requesting file(s) without gzip encoding.",434 E_USER_NOTICE);435 }436 }437 438 803 if(!empty($this->referer)) 439 804 $headers .= "Referer: ".$this->referer."\r\n"; … … 468 833 $headers .= "Content-length: ".strlen($body)."\r\n"; 469 834 if(!empty($this->user) || !empty($this->pass)) 470 $headers .= "Authorization: BASIC ".base64_encode($this->user.":".$this->pass)."\r\n"; 835 $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; 836 837 //add proxy auth headers 838 if(!empty($this->proxy_user)) 839 $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n"; 840 471 841 472 842 $headers .= "\r\n"; … … 481 851 $this->_redirectaddr = false; 482 852 unset($this->headers); 483 484 // content was returned gzip encoded?485 $is_gzipped = false;486 853 487 854 while($currentHeader = fgets($fp,$this->_maxlinelen)) … … 493 860 } 494 861 495 // if($currentHeader == "\r\n") 496 if(preg_match("/^\r?\n$/", $currentHeader) ) 497 break; 862 if($currentHeader == "\r\n") 863 break; 498 864 499 865 // if a header begins with Location: or URI:, set the redirect … … 501 867 { 502 868 // get URL portion of the redirect 503 preg_match("/^(Location:|URI:) \s+(.*)/",chop($currentHeader),$matches);869 preg_match("/^(Location:|URI:)[ ]+(.*)/i",chop($currentHeader),$matches); 504 870 // look for :// in the Location header to see if hostname is included 505 871 if(!preg_match("|\:\/\/|",$matches[2])) … … 525 891 $this->response_code = $currentHeader; 526 892 } 527 528 if (preg_match("/Content-Encoding: gzip/", $currentHeader) ) { 529 $is_gzipped = true; 530 } 531 893 532 894 $this->headers[] = $currentHeader; 533 895 } 534 896 535 # $results = fread($fp, $this->maxlength); 536 $results = ""; 537 while ( $data = fread($fp, $this->maxlength) ) { 538 $results .= $data; 539 if ( 540 strlen($results) > $this->maxlength ) { 541 break; 542 } 543 } 544 545 // gunzip 546 if ( $is_gzipped ) { 547 // per http://www.php.net/manual/en/function.gzencode.php 548 $results = substr($results, 10); 549 $results = gzinflate($results); 550 } 551 897 $results = ''; 898 do { 899 $_data = fread($fp, $this->maxlength); 900 if (strlen($_data) == 0) { 901 break; 902 } 903 $results .= $_data; 904 } while(true); 905 552 906 if ($this->read_timeout > 0 && $this->_check_timeout($fp)) 553 907 { … … 558 912 // check if there is a a redirect meta tag 559 913 560 if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]+URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) 914 if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) 915 561 916 { 562 917 $this->_redirectaddr = $this->_expandlinks($match[1],$URI); … … 604 959 $headers[] = "User-Agent: ".$this->agent; 605 960 if(!empty($this->host)) 606 $headers[] = "Host: ".$this->host; 961 if(!empty($this->port)) 962 $headers[] = "Host: ".$this->host.":".$this->port; 963 else 964 $headers[] = "Host: ".$this->host; 607 965 if(!empty($this->accept)) 608 966 $headers[] = "Accept: ".$this->accept; … … 641 999 $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); 642 1000 643 for($curr_header = 0; $curr_header < count($headers); $curr_header++) 644 $cmdline_params .= " -H \"".$headers[$curr_header]."\""; 1001 for($curr_header = 0; $curr_header < count($headers); $curr_header++) { 1002 $safer_header = strtr( $headers[$curr_header], "\"", " " ); 1003 $cmdline_params .= " -H \"".$safer_header."\""; 1004 } 645 1005 646 1006 if(!empty($body)) … … 650 1010 $cmdline_params .= " -m ".$this->read_timeout; 651 1011 652 $headerfile = uniqid(time()); 653 654 # accept self-signed certs 655 $cmdline_params .= " -k"; 656 exec($this->curl_path." -D \"/tmp/$headerfile\"".$cmdline_params." ".$URI,$results,$return); 1012 $headerfile = tempnam($temp_dir, "sno"); 1013 1014 $safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access 1015 exec($this->curl_path." -D \"$headerfile\"".$cmdline_params." \"".$safer_URI."\"",$results,$return); 657 1016 658 1017 if($return) … … 665 1024 $results = implode("\r\n",$results); 666 1025 667 $result_headers = file(" /tmp/$headerfile");1026 $result_headers = file("$headerfile"); 668 1027 669 1028 $this->_redirectaddr = false; … … 677 1036 { 678 1037 // get URL portion of the redirect 679 preg_match("/^(Location: |URI:) (.*)/",chop($result_headers[$currentHeader]),$matches);1038 preg_match("/^(Location: |URI:)\s+(.*)/",chop($result_headers[$currentHeader]),$matches); 680 1039 // look for :// in the Location header to see if hostname is included 681 1040 if(!preg_match("|\:\/\/|",$matches[2])) … … 694 1053 695 1054 if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) 696 { 697 $this->response_code = $result_headers[$currentHeader]; 698 if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$this->response_code, $match)) 699 { 700 $this->status= $match[1]; 701 } 702 } 1055 $this->response_code = $result_headers[$currentHeader]; 1056 703 1057 $this->headers[] = $result_headers[$currentHeader]; 704 1058 } … … 706 1060 // check if there is a a redirect meta tag 707 1061 708 if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s] +URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))1062 if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) 709 1063 { 710 1064 $this->_redirectaddr = $this->_expandlinks($match[1],$URI); … … 725 1079 $this->results = $results; 726 1080 727 unlink(" /tmp/$headerfile");1081 unlink("$headerfile"); 728 1082 729 1083 return true; … … 739 1093 for($x=0; $x<count($this->headers); $x++) 740 1094 { 741 if(preg_match( "/^set-cookie:[\s]+([^=]+)=([^;]+)/i", $this->headers[$x],$match))742 $this->cookies[$match[1]] = $match[2];1095 if(preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x],$match)) 1096 $this->cookies[$match[1]] = urldecode($match[2]); 743 1097 } 744 1098 } … … 774 1128 { 775 1129 $this->_isproxy = true; 1130 776 1131 $host = $this->proxy_host; 777 1132 $port = $this->proxy_port; … … 839 1194 settype($formvars, "array"); 840 1195 settype($formfiles, "array"); 1196 $postdata = ''; 841 1197 842 1198 if (count($formvars) == 0 && count($formfiles) == 0)
