| ... | ... | @@ -396,20 +396,24 @@ fn lookupDns(io: Io, lookup_canon_name: []const u8, rc: *const ResolvConf, optio |
| 396 | 396 | std.posix.RR.A => { |
| 397 | 397 | const data = record.packet[record.data_off..][0..record.data_len]; |
| 398 | 398 | if (data.len != 4) return error.InvalidDnsARecord; |
| 399 | | options.addresses_buffer[addresses_len] = .{ .ip4 = .{ |
| 400 | | .bytes = data[0..4].*, |
| 401 | | .port = options.port, |
| 402 | | } }; |
| 403 | | addresses_len += 1; |
| 399 | if (addresses_len < options.addresses_buffer.len) { |
| 400 | options.addresses_buffer[addresses_len] = .{ .ip4 = .{ |
| 401 | .bytes = data[0..4].*, |
| 402 | .port = options.port, |
| 403 | } }; |
| 404 | addresses_len += 1; |
| 405 | } |
| 404 | 406 | }, |
| 405 | 407 | std.posix.RR.AAAA => { |
| 406 | 408 | const data = record.packet[record.data_off..][0..record.data_len]; |
| 407 | 409 | if (data.len != 16) return error.InvalidDnsAAAARecord; |
| 408 | | options.addresses_buffer[addresses_len] = .{ .ip6 = .{ |
| 409 | | .bytes = data[0..16].*, |
| 410 | | .port = options.port, |
| 411 | | } }; |
| 412 | | addresses_len += 1; |
| 410 | if (addresses_len < options.addresses_buffer.len) { |
| 411 | options.addresses_buffer[addresses_len] = .{ .ip6 = .{ |
| 412 | .bytes = data[0..16].*, |
| 413 | .port = options.port, |
| 414 | } }; |
| 415 | addresses_len += 1; |
| 416 | } |
| 413 | 417 | }, |
| 414 | 418 | std.posix.RR.CNAME => { |
| 415 | 419 | _, canonical_name = expand(record.packet, record.data_off, options.canonical_name_buffer) catch |
| ... | ... | @@ -472,6 +476,7 @@ fn lookupHostsReader(host_name: HostName, options: LookupOptions, reader: *Io.Re |
| 472 | 476 | error.ReadFailed => return error.ReadFailed, |
| 473 | 477 | error.EndOfStream => break, |
| 474 | 478 | }; |
| 479 | reader.toss(1); |
| 475 | 480 | var split_it = std.mem.splitScalar(u8, line, '#'); |
| 476 | 481 | const no_comment_line = split_it.first(); |
| 477 | 482 | |