*I was going to bring this up in today's meeting, but I'm not sure if I can
turn up due to Internet issues.*

So I've been working on CORS on the past week, and it's more and more
evident that it would be best if most of the Fetch spec
<http://fetch.spec.whatwg.org/> (except the webidls at the bottom) was
written as a separate crate. Basically, have some Request and Response
structs that have the same flags and behavior as the ones defined in Fetch.
This would mean that we can easily implement stuff that uses the Fetch
spec, just by creating a Request with the appropriate flags set and firing
off a fetch event. Currently the only things that use Fetch are XHR, fetch()
<http://fetch.spec.whatwg.org/#fetch-method>, and the File API
<http://dev.w3.org/2006/webapi/FileAPI/>, however it seems like the HTML5
spec will soon be modified to use Fetch as well (i.e. for the image and
iframe tags).

I was thinking of creating a rust-fetch library (shouldn't be too hard),
and submoduling it, however a major issue is choosing which http library to
use. rust-http exists, and is used in Servo, but it's currently in
maintenance mode.

It's got a bunch of issues (some of which I've fixed in the past), the most
pressing of which is that it doesn't store the raw bytes and instead
converts headers (and Methods and all) to a parsed object, sometimes
incorrectly. This can be fixed, but it would take major changes and in
general the library has other issues as well.

Teepee is the replacement for rust-http but it's progressing rather slowly
right now. It's also "over-engineered" (as Simon puts it), but it seems to
fix most of rust-http's problems. I guess we'll eventually be switching
over to Teepee.

One option is to simply fork rust-http and replace most of the complicated
strongly-typed objects with simpler ones, and separate out the parsing
code. I probably can do this, but I'm not sure. This might even be useful
as a permanent replacement for rust-http (that we maintain) since it's
simpler and we don't really use the bits I propose to replace except in XHR
(which would be simplified by the change).

Couple of questions:

   - Do we want a Fetch crate? If so, what's the best way to handle its
   http library? (One option is to simply wait for Teepee)
   - What should we do about our own http library?
   - Thoughts in general?

(These can be discussed in the meeting, just putting this mail out with
most of the details in case I can't turn up)

Thanks,
-Manish Goregaokar
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to