chris-morgan / rust-http

Completely OBSOLETE Rust HTTP library (server and client)
Other
390 stars 110 forks source link

add Access-Control-Allow-Origin #183

Closed jaredly closed 9 years ago

jaredly commented 9 years ago

fixes #182

reem commented 9 years ago

If it's this easy to add I don't see why not. @Ogeon you were discussing this before, so I'll let it be your call.

Ogeon commented 9 years ago

As I wrote before, I know close to nothing about this, but I can give it a try. It looks like there are a handful of access control headers, but this is a good start, and this particular header is more or less this simple. It could also be given some more restrictions using a "selection" (I can't make up a better name at the moment) type with a Url:

pub enum Selection<T> {
    All,
    One(T)
}

...but I don't know if this unrestricted version is closer to how it is used. I think it's fine otherwise, from what I can tell. What do you think? Is it ready or do you want to develop it further?

By the way, I think you can skip the // More Headers! comment. :)

jaredly commented 9 years ago

Given that this lib is in dying/maintenance mode, I'm happy with it, but if you want I can add the enum.

Ogeon commented 9 years ago

It can always be added later. I'll merge it. Thanks!