Commit Graph

10770 Commits

Author SHA1 Message Date
Jeff Olson
e097ff6398 std: add test for net::ip::get_addr failure 2012-06-29 15:41:56 -07:00
Jeff Olson
e5212de671 std: beef up ipv4 validation a bit
now the best of what we had prior to libuv integration (proper
validation of an ipv4 string), along with libuv support
(initial ipv6 support)

libuv has even weaker facilities for validating an input ipv6
(but still more than what we had), so eventually the "right"
answer would be to roll a proper ipv6 address string parser
in rust
2012-06-29 15:41:56 -07:00
Jeff Olson
81157ff1d2 std: add uv::ll::is_ipv6_addrinfo and get_INADDR_NONE 2012-06-29 15:41:56 -07:00
Jeff Olson
8794815da9 rt: get rid of unused helpers for AF_INET and add bool-based ones, instead 2012-06-29 15:41:56 -07:00
Jeff Olson
5014a2a413 std: whitespace/comment clean 2012-06-29 15:41:56 -07:00
Jeff Olson
61cc8a07f8 rt: whitespace cleanup in rust_uv 2012-06-29 15:41:56 -07:00
Jeff Olson
5304698621 std: net::ip::get_addr is working w/ happy path test. needs more. 2012-06-29 15:41:56 -07:00
Jeff Olson
bcc341f5fb rt: adding uv_freeaddrinfo binding and tweek signature for uv_getaddrinfo 2012-06-29 15:41:56 -07:00
Jeff Olson
467e4fba33 WIP set aside unshift 2012-06-29 15:41:56 -07:00
Jeff Olson
cac2a04667 fix typo in rustrt.def.in 2012-06-29 15:41:56 -07:00
Jeff Olson
b2894752e4 std: roughcut impl of net::ip::get_addr()
still needs tests
2012-06-29 15:41:56 -07:00
Jeff Olson
8afc113b61 std: wire-up low-level bindings to libuv's uv_getaddrinfo API and friends 2012-06-29 15:41:56 -07:00
Jeff Olson
237589b3c0 rt: more helper functions to get uv_getaddrinfo going 2012-06-29 15:41:56 -07:00
Jeff Olson
ccd4bfb6ca std: mapped addrinfo, addr_in and uv_getaddrinfo_t as rust records 2012-06-29 15:41:55 -07:00
Jeff Olson
2ef9548f2c rt: more sizeof helpers + misc consts for uv_getaddrinfo 2012-06-29 15:41:55 -07:00
Jeff Olson
334c783d36 std: adding net::ip::v6 utils and rudimentary tests, huzzah! (see caveats)
libuv's own ip vetting code appears to in a somewhat woeful state,
for both ipv4 and ipv6 (there are some notes in the tests for net_ip, as
well as stuff added in uv_ll). They are aware of this and welcome patches.

I have rudimentary code in place that can verify whether the provided str
ip was, in fact, validly parsed by libuv, making a few assumptions:

* for ipv4, we assume that the platform's INADDR_NONE val is 0xffffffff ,
I should write a helper to return this value from the platform's libc
headers instead of hard-coding it in rust.
* for ipv6, we assume that the library will always return '::' for
malformed inputs.. as is the case in 64bit ubuntu. I need to verify this
on other platforms.. but at least the debugging output is in place, so
if expectations don't line up, it'll be straightforward to address
2012-06-29 15:41:55 -07:00
Jeff Olson
b6b138630e std: getting uv_ip6_* utils working in uv::ll
.. stub out some brokeness in net::tcp as a result of ipv6 coming online
2012-06-29 15:41:55 -07:00
Jeff Olson
30f26ddbc9 std: adding uv::ll::ip4_name and refactored net::ip to use it
replaces net::ip's previously, hand-rolled impl for ipv4 addr parsing..
we're relying on libuv, now
2012-06-29 15:41:55 -07:00
Jeff Olson
c027292846 std: mapping additional libuv ip string helpers.. add test for sockaddr_in6
.. but the test is kind of broken.. it appears that rust pads structs for
alignment purposes? I can't get the struct to == 28.. that appears to
be the native size of sockaddr_in6.. so we have a size 32 struct, for now.
2012-06-29 15:41:55 -07:00
Jeff Olson
511873afe3 rt: add remaining ip string parser/formatter helpers from uv 2012-06-29 15:41:55 -07:00
Jeff Olson
708b5d986e core: str::as_slice is unneeded, yay! fixes std::net::tcp socket_buf test
i mistook an "unconstrained type" error, due to type-inference messup
because i didnt have return vals in some closure wired-up right, for being
due to not having a str as a str/& (a str will actually auto-coerce to a
str/&, so str::as_slice was erroneously added. my bad).
2012-06-29 15:41:55 -07:00
Jeff Olson
942d3b527e std: test impl for using tcp_socket_buf and its reader/writer impls. fails.
needs work. probably the slice code and/or the way that the tcp_socket_buf
is wrapped in a shared box
2012-06-29 15:41:55 -07:00
Jeff Olson
099d080233 core: adding str::as_slice .. most likely broken 2012-06-29 15:41:55 -07:00
Jeff Olson
99d2ec3ad1 std: renaming impl for tcp_socket and reshuffle/cleanup for tcp_socket_buf 2012-06-29 15:41:55 -07:00
Jeff Olson
156a4317f6 std: finish impl of io::writer for tcp_socket_buf 2012-06-29 15:41:55 -07:00
Jeff Olson
af3fa5306d std: rework signature of tcp::write common impl to make io::writer possible 2012-06-29 15:41:55 -07:00
Jeff Olson
28ab8b841a std: add buffered wrapper to tcp_socket + io::reader impl. no tests, yet.
need to do some other work, in the subsequent commit, to add io::writer,
then tests.
2012-06-29 15:41:55 -07:00
Jeff Olson
5ec68ac482 core: export vec::unshift 2012-06-29 15:41:55 -07:00
Jeff Olson
31c33ca5ff std: doc and misc cleanup in net::tcp
* updated rustdoc info for several functions
* changed read_stop to take control of the port returned by read_start
* made write_future do an explicit data copy with the binary vector it is
passed
2012-06-29 15:41:55 -07:00
Jeff Olson
f7e3a4e036 std: EADDRINUSE and EACCES err tests for tcp server + more cleanup
.. confounded resolve!
2012-06-29 15:41:55 -07:00
Jeff Olson
235f6c7ab7 std: factor main body of tcp::listen into reusable listen_common 2012-06-29 15:41:55 -07:00
Jeff Olson
d79d0aa1c8 std: some cleanup in net::tcp rename listen_to_conn->listen 2012-06-29 15:41:55 -07:00
Jeff Olson
68e129dc39 std: dump the tcp::new_listener server API 2012-06-29 15:41:55 -07:00
Jeff Olson
5d86686e7f std: mod cleanup, impl/test for conn. refused err + mem leak fix 2012-06-29 15:41:55 -07:00
Jeff Olson
900e446015 std: import/export cleanup in net_tcp 2012-06-29 15:41:54 -07:00
Jeff Olson
79e279ee12 std: kludge export of net_ip in std.rc until submodule export is sorted 2012-06-29 15:41:54 -07:00
Michael Sullivan
e6baf44f19 Switch back to USE_SNAPSHOT_CORELIB=0. 2012-06-29 15:34:39 -07:00
Michael Sullivan
e9b4336bfd Register snapshots. 2012-06-29 15:33:52 -07:00
Michael Sullivan
a3c7d93c77 Get rid of basically all of the remaining old style vecs in tests. 2012-06-29 15:08:12 -07:00
Michael Sullivan
3bf5fef0e5 Refactor syntax exts some. Don't ever emit bare vectors. 2012-06-29 14:38:33 -07:00
Michael Sullivan
7aa43b2599 Make fmt use a bitmask instead of a vector of flags. Closes #1993. 2012-06-28 23:36:00 -07:00
Michael Sullivan
498b3ff57f Register snapshots. 2012-06-28 22:55:44 -07:00
Ben Blum
d7823de5e2 update rust.vim to hilight foo::bar and more 2012-06-28 21:11:54 -04:00
Michael Sullivan
e7760470b4 Make a bunch of tests stop using the deprecated vector syntax. 2012-06-28 17:33:15 -07:00
Eric Holk
c9e8b7de82 Merge branch 'master' of github.com:mozilla/rust into incoming 2012-06-28 17:30:36 -07:00
Michael Sullivan
810677efb5 Parse ~[...] as [...]/~. Same for @ and &. Closes #2747. 2012-06-28 17:10:06 -07:00
Ben Blum
b6f103e7f9 Fix rt-sched-1.rs (broke in 6fc730b) 2012-06-28 19:46:57 -04:00
Michael Sullivan
e9382ef1ac Have #fmt use str::concat to build up the string instead of using binary +. Closes #2746. 2012-06-28 16:30:05 -07:00
Ben Blum
b2b498183a Add test case for issue #2734 (xfailed) 2012-06-28 19:26:12 -04:00
Ben Blum
6fc730baf6 Cleanup failure handling around rust_new_task_in_sched - closes #2668 2012-06-28 19:02:48 -04:00