- cur_fwd->forward_host = strdup(p);
-
- if ((*cur_fwd->forward_host == '[')
- && (NULL != (p = strchr(cur_fwd->forward_host, ']'))))
- {
- *p++ = '\0';
- memmove(cur_fwd->forward_host, cur_fwd->forward_host + 1,
- (size_t)(p - cur_fwd->forward_host));
- if (*p == ':')
- {
- cur_fwd->forward_port = atoi(++p);
- }
- }
- else if (NULL != (p = strchr(cur_fwd->forward_host, ':')))
- {
- *p++ = '\0';
- cur_fwd->forward_port = atoi(p);
- }
-
- if (cur_fwd->forward_port <= 0)
- {
- cur_fwd->forward_port = 8000;
- }
+ cur_fwd->forward_port = 8000;
+ parse_forwarder_address(p, &cur_fwd->forward_host,
+ &cur_fwd->forward_port);