int i;
char *tpath, *ttpath;
- resource = url_parse((char *) path);
+ resource = php_url_parse((char *) path);
if (resource == NULL) {
php_error(E_WARNING, "Invalid URL specified, %s", path);
*issock = BAD_URL;
return NULL;
} else if (resource->path == NULL) {
php_error(E_WARNING, "No file-path specified");
- free_url(resource);
+ php_url_free(resource);
*issock = BAD_URL;
return NULL;
}
goto errexit;
#if 0
if ((fpc = fdopen(*socketd, "r+")) == NULL) {
- free_url(resource);
+ php_url_free(resource);
return NULL;
}
#ifdef HAVE_SETVBUF
if ((setvbuf(fpc, NULL, _IONBF, 0)) != 0) {
- free_url(resource);
+ php_url_free(resource);
fclose(fpc);
return NULL;
}
/* when reading file, it must exist */
if (result > 299 || result < 200) {
php_error(E_WARNING, "File not found");
- free_url(resource);
+ php_url_free(resource);
SOCK_FCLOSE(*socketd);
*socketd = 0;
errno = ENOENT;
/* when writing file, it must NOT exist */
if (result <= 299 && result >= 200) {
php_error(E_WARNING, "File already exists");
- free_url(resource);
+ php_url_free(resource);
SOCK_FCLOSE(*socketd);
*socketd = 0;
errno = EEXIST;
#if 0
if (mode[0] == 'r') {
if ((fp = fdopen(*socketd, "r+")) == NULL) {
- free_url(resource);
+ php_url_free(resource);
return NULL;
}
} else {
if ((fp = fdopen(*socketd, "w+")) == NULL) {
- free_url(resource);
+ php_url_free(resource);
return NULL;
}
}
#ifdef HAVE_SETVBUF
if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
- free_url(resource);
+ php_url_free(resource);
fclose(fp);
return NULL;
}
#endif
#endif
- free_url(resource);
+ php_url_free(resource);
*issock = 1;
return (fp);
errexit:
- free_url(resource);
+ php_url_free(resource);
SOCK_FCLOSE(*socketd);
*socketd = 0;
return NULL;
char *http_header_line;
int http_header_line_length, http_header_line_size;
- resource = url_parse((char *) path);
+ resource = php_url_parse((char *) path);
if (resource == NULL) {
php_error(E_WARNING, "Invalid URL specified, %s", path);
*issock = BAD_URL;
if (*socketd == -1) {
SOCK_FCLOSE(*socketd);
*socketd = 0;
- free_url(resource);
+ php_url_free(resource);
return NULL;
}
#if 0
if ((fp = fdopen(*socketd, "r+")) == NULL) {
- free_url(resource);
+ php_url_free(resource);
return NULL;
}
#ifdef HAVE_SETVBUF
if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
- free_url(resource);
+ php_url_free(resource);
return NULL;
}
#endif
if (resource->user != NULL && resource->pass != NULL) {
scratch = (char *) emalloc(strlen(resource->user) + strlen(resource->pass) + 2);
if (!scratch) {
- free_url(resource);
+ php_url_free(resource);
return NULL;
}
strcpy(scratch, resource->user);
if (!reqok) {
SOCK_FCLOSE(*socketd);
*socketd = 0;
- free_url(resource);
+ php_url_free(resource);
if (location[0] != '\0') {
zval **response_header_new, *entry, **entryp;
ELS_FETCH();
goto out;
}
}
- free_url(resource);
+ php_url_free(resource);
*issock = 1;
out:
{
/* {{{ free_url
*/
-void free_url(php_url * theurl)
+PHPAPI void php_url_free(php_url * theurl)
{
if (theurl->scheme)
efree(theurl->scheme);
/* {{{ url_parse
*/
-php_url *url_parse(char *str)
+PHPAPI php_url *php_url_parse(char *str)
{
regex_t re;
regmatch_t subs[11];
}
convert_to_string_ex(str);
- resource = url_parse((*str)->value.str.val);
+ resource = php_url_parse((*str)->value.str.val);
if (resource == NULL) {
php_error(E_WARNING, "unable to parse url (%s)", (*str)->value.str.val);
}
/* allocate an array for return */
if (array_init(return_value) == FAILURE) {
- free_url(resource);
+ php_url_free(resource);
RETURN_FALSE;
}
/* add the various elements to the array */
add_assoc_string(return_value, "query", resource->query, 1);
if (resource->fragment != NULL)
add_assoc_string(return_value, "fragment", resource->fragment, 1);
- free_url(resource);
+ php_url_free(resource);
}
/* }}} */
/* {{{ php_url_encode
*/
-char *php_url_encode(char *s, int len)
+PHPAPI char *php_url_encode(char *s, int len)
{
register int x, y;
unsigned char *str;
/* {{{ php_url_decode
*/
-int php_url_decode(char *str, int len)
+PHPAPI int php_url_decode(char *str, int len)
{
char *dest = str;
char *data = str;
/* {{{ php_raw_url_encode
*/
-char *php_raw_url_encode(char *s, int len)
+PHPAPI char *php_raw_url_encode(char *s, int len)
{
register int x, y;
unsigned char *str;
/* {{{ php_raw_url_decode
*/
-int php_raw_url_decode(char *str, int len)
+PHPAPI int php_raw_url_decode(char *str, int len)
{
char *dest = str;
char *data = str;
char *fragment;
} php_url;
-void free_url(php_url *);
-extern php_url *url_parse(char *);
-extern int php_url_decode(char *, int); /* return value: length of decoded string */
-extern char *php_url_encode(char *, int);
-extern int php_raw_url_decode(char *, int); /* return value: length of decoded string */
-extern char *php_raw_url_encode(char *, int);
+PHPAPI void php_url_free(php_url *);
+PHPAPI extern php_url *php_url_parse(char *);
+PHPAPI extern int php_url_decode(char *, int); /* return value: length of decoded string */
+PHPAPI extern char *php_url_encode(char *, int);
+PHPAPI extern int php_raw_url_decode(char *, int); /* return value: length of decoded string */
+PHPAPI extern char *php_raw_url_encode(char *, int);
PHP_FUNCTION(parse_url);
PHP_FUNCTION(urlencode);