CSC/ECE 517 Spring 2016 OSS M1606

From Expertiza_Wiki
Revision as of 23:38, 22 March 2016 by Mverma4 (talk | contribs)
Jump to navigation Jump to search

M1606: Implementing HTTP authorization UI and persistent sessions

[ https://en.wikipedia.org/wiki/Web_page Web pages ] make use of [ https://en.wikipedia.org/wiki/Session_(computer_science) sessions ] all the time. These are required to persist throughout the life of the user's interaction with the web site or web application.This is supported by Servo as of today. However it doesn't support the persistence of data upon the closing and reopening of the web browser.<ref> https://github.com/servo/servo/wiki/Persistent-sessions-student-project</ref>

With this project we aim to create the necessary infrastructure to support this.

Introduction

Servo

Servo is a web browser layout engine written in Rust and is currently being developed by Mozilla Research. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks. Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.<ref>https://en.wikipedia.org/wiki/Servo_(layout_engine)</ref>

Rust

Rust is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language. Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.<ref>https://en.wikipedia.org/wiki/Rust_(programming_language)</ref>

Scope

The scope of the project is limited to the steps mentioned below:

1) Compile Servo and ensure that it runs on tests/html/about-mozilla.html.

2) Add a new command line flag --profile-dir [path] that stores an optional directory path in the Opts struct in opts.rs, creating the directory if it does not exist.

3) Create Rust FFI bindings for the tinyfiledialogs library to allow calling the C methods from Servo.

4) In resource_thread.rs, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an Arc<Rwlock<>> value, to enable sharing it between threads).

5) In modify_request_headers in http_loader.rs, implement the remaining pieces of step 12 of the appropriate specification using this new authorization cache.

Implementation

Step 1:

The project requirement initially stated that we build and Compile servo. Servo is built with Cargo, the Rust package manager. Mozilla's Mach tools are used to orchestrate the build and other tasks.

Step 2:

The project required us to add a new command line flag that stored an optional directory path. The job of this flag was to create a directory in the absence of it.

Step 3:

To create the Rust FFI bindings for the tinyfiledialogs library so as to allow the C methods to be called from Servo.

Step 4:

In the file resource_thread.rs, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member.

Step 5:

In the modify_request_headers in http_loader.rs, we were required to implement a portion of the appropriate specification using this new authorization cache.

Pull Request

These are the pull requests for the modifications we’ve made:

1) Added a new command line flag --profile-dir

2) Added Rust FFI bindings to lib.rs

3) Added authorization cache to resources & set authorization header from it if url does not have credentials

Conclusion

The definition of the HTTP authorization cache and the implementation of the appropriate specification in the http_loader.rs, ensures the authorization UI will appear when a 401 HTTP response is received.

The Rust FFI Bindings for the tinyfiledialogs library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response.

The –profile-dir [path] command line flag will store an optional directory path, creating the directory in case it doesn’t exist.

References

<references/>