equal
deleted
inserted
replaced
1 <?php |
1 <?php |
2 |
2 |
3 /* |
3 /* |
4 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
4 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
5 * Version 1.1.6 (Caoineag beta 1) |
5 * Copyright (C) 2006-2009 Dan Fuhry |
6 * Copyright (C) 2006-2008 Dan Fuhry |
|
7 * class_http.php - Pure PHP HTTP client library |
6 * class_http.php - Pure PHP HTTP client library |
8 * |
7 * |
9 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
8 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
10 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
9 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
11 * |
10 * |
196 * @param int Optional. The port to open the request on. Defaults to 80. |
195 * @param int Optional. The port to open the request on. Defaults to 80. |
197 */ |
196 */ |
198 |
197 |
199 function Request_HTTP($host, $uri, $method = 'GET', $port = 80) |
198 function Request_HTTP($host, $uri, $method = 'GET', $port = 80) |
200 { |
199 { |
201 if ( !preg_match('/^(([a-z0-9-]+\.)*?)([a-z0-9-]+)$/', $host) ) |
200 if ( !preg_match('/^(?:(([a-z0-9-]+\.)*?)([a-z0-9-]+)|\[[a-f0-9:]+\])$/', $host) ) |
202 throw new Exception(__CLASS__ . ': Invalid hostname'); |
201 throw new Exception(__CLASS__ . ': Invalid hostname'); |
|
202 // Yes - this really does support IPv6 URLs! |
203 $this->host = $host; |
203 $this->host = $host; |
204 $this->uri = $uri; |
204 $this->uri = $uri; |
205 if ( is_int($port) && $port >= 1 && $port <= 65535 ) |
205 if ( is_int($port) && $port >= 1 && $port <= 65535 ) |
206 $this->port = $port; |
206 $this->port = $port; |
207 else |
207 else |