Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
3b67e90a
Commit
3b67e90a
authored
27 years ago
by
Henrik (Grubba) Grubbström
Browse files
Options
Downloads
Patches
Plain Diff
Fixed several bugs.
Rev: lib/modules/Protocols.pmod/DNS.pmod:1.10
parent
8d35ffaa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Protocols.pmod/DNS.pmod
+12
-6
12 additions, 6 deletions
lib/modules/Protocols.pmod/DNS.pmod
with
12 additions
and
6 deletions
lib/modules/Protocols.pmod/DNS.pmod
+
12
−
6
View file @
3b67e90a
...
@@ -213,9 +213,9 @@ class client {
...
@@ -213,9 +213,9 @@ class client {
static private int is_ip(string ip)
static private int is_ip(string ip)
{
{
return(replace(
rest
,
return(replace(
ip
,
({ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "." }),
({ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "." }),
({ "", "", "", "", "", "", "", "", ""
;
"", "" })) == "");
({ "", "", "", "", "", "", "", "", ""
,
"", "" })) == "");
}
}
static private mapping etc_hosts;
static private mapping etc_hosts;
...
@@ -225,17 +225,17 @@ class client {
...
@@ -225,17 +225,17 @@ class client {
if (!etc_hosts) {
if (!etc_hosts) {
string raw = Stdio.read_file("/etc/hosts");
string raw = Stdio.read_file("/etc/hosts");
etc_hosts = ([ "localhost"
,
"127.0.0.1" ]);
etc_hosts = ([ "localhost"
:
"127.0.0.1" ]);
if (raw) {
if (raw) {
foreach(raw/"\n", string line) {
foreach(raw/"\n", string line) {
// Handle comments, and split the line on white-space
// Handle comments, and split the line on white-space
line = replace((line/"#")[0], "\t", " ");
line =
lower_case(
replace((line/"#")[0], "\t", " ")
)
;
array arr = (line/" ") - ({ "" });
array arr = (line/" ") - ({ "" });
if (sizeof(arr) > 1) {
if (sizeof(arr) > 1) {
if (is_ip(arr[0])) {
if (is_ip(arr[0])) {
foreach(arr[1..], name) {
foreach(arr[1..],
string
name) {
etc_hosts[name] = arr[0];
etc_hosts[name] = arr[0];
}
}
} else {
} else {
...
@@ -247,7 +247,7 @@ class client {
...
@@ -247,7 +247,7 @@ class client {
// Couldn't read /etc/hosts.
// Couldn't read /etc/hosts.
}
}
}
}
return(etc_hosts[host]);
return(etc_hosts[
lower_case(
host
)
]);
}
}
array(string) nameservers = ({});
array(string) nameservers = ({});
...
@@ -306,6 +306,12 @@ class client {
...
@@ -306,6 +306,12 @@ class client {
}
}
if(domain)
if(domain)
domains = ({ domain }) + domains;
domains = ({ domain }) + domains;
domains = Array.map(domains, lambda(string d) {
if (d[-1] == '.') {
return d[..sizeof(d)-2];
}
return d;
});
} else {
} else {
nameservers= ({ server });
nameservers= ({ server });
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment