<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dedefish</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dedefish"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Dedefish"/>
	<updated>2026-06-03T11:13:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102339</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102339"/>
		<updated>2016-04-26T21:38:13Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Decoding the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
==='''Gui testing for the entire project scope'''===&lt;br /&gt;
&lt;br /&gt;
    $ git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    $ cd servo&lt;br /&gt;
&lt;br /&gt;
    $ ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    enter 'test' for username and enter 'test' for password&lt;br /&gt;
&lt;br /&gt;
    //wait for servo to load successful response and then exit (make sure it is completely loaded before exiting or it may crash)&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with &lt;br /&gt;
    //the directory profile_dir that contains the credentials entered in json format&lt;br /&gt;
&lt;br /&gt;
    //now run servo again with the same arguments to see that the auth cache was written to file and then loaded from file&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    //The page should load with a success without needing any username or password this time&lt;br /&gt;
&lt;br /&gt;
    //you can try other urls that contain the other data ( cookies, hsts_list, local_data ) and &lt;br /&gt;
    //close servo and look at the data written to the file (now all pages contain all data)&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project. Select 720p quality in settings if you can.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102338</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102338"/>
		<updated>2016-04-26T21:33:24Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Gui testing for the entire project scope */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Decoding the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
==='''Gui testing for the entire project scope'''===&lt;br /&gt;
&lt;br /&gt;
    $ git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    $ cd servo&lt;br /&gt;
&lt;br /&gt;
    $ ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    enter 'test' for username and enter 'test' for password&lt;br /&gt;
&lt;br /&gt;
    //wait for servo to load successful response and then exit (make sure it is completely loaded before exiting or it may crash)&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with &lt;br /&gt;
    //the directory profile_dir that contains the credentials entered in json format&lt;br /&gt;
&lt;br /&gt;
    //now run servo again with the same arguments to see that the auth cache was written to file and then loaded from file&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    //The page should load with a success without needing any username or password this time&lt;br /&gt;
&lt;br /&gt;
    //you can try other urls that contain the other data ( cookies, hsts_list, local_data ) and &lt;br /&gt;
    //close servo and look at the data written to the file (now all pages contain all data)&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102337</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102337"/>
		<updated>2016-04-26T21:32:32Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Gui testing for the entire project scope */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Decoding the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
==='''Gui testing for the entire project scope'''===&lt;br /&gt;
&lt;br /&gt;
    $ git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    $ cd servo&lt;br /&gt;
&lt;br /&gt;
    $ ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    enter 'test' for username and enter 'test' for password&lt;br /&gt;
&lt;br /&gt;
    //wait for servo to load successful response and then exit (make sure it is completely loaded before exiting or it may crash)&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with &lt;br /&gt;
    //the directory profile_dir that contains the credentials entered in json format&lt;br /&gt;
&lt;br /&gt;
    //now run servo again with the same arguments to see that the auth cache was written to file and then loaded from file&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    //The page should load with a success without needed any username or password this time&lt;br /&gt;
&lt;br /&gt;
    //you can try other urls that contain the other data ( cookies, hsts_list, local_data ) and &lt;br /&gt;
    //close servo and look at the data written to the file (now all pages contain all data)&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102336</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102336"/>
		<updated>2016-04-26T21:32:08Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Gui testing for the entire project scope */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Decoding the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
==='''Gui testing for the entire project scope'''===&lt;br /&gt;
&lt;br /&gt;
    $ git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    $ cd servo&lt;br /&gt;
&lt;br /&gt;
    $ ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    enter 'test' for username and enter 'test' for password&lt;br /&gt;
&lt;br /&gt;
    //wait for servo to load successful response and then exit (make sure it is completely loaded before exiting or it may crash)&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with &lt;br /&gt;
    //the directory profile_dir that contains the credentials entered in json format&lt;br /&gt;
&lt;br /&gt;
    //now run servo again with the same arguments to see that the auth cache was written to file and then loaded from file&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    //The page should load with a success without needed any username or password this time&lt;br /&gt;
&lt;br /&gt;
    //you can try other urls that contain the other data ( cookies, hsts_list, local_data ) and close servo and look at the data written to the file (now all pages contain all data)&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102335</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102335"/>
		<updated>2016-04-26T21:31:22Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Gui testing for the entire project scope */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Decoding the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
==='''Gui testing for the entire project scope'''===&lt;br /&gt;
&lt;br /&gt;
    $ git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    $ cd servo&lt;br /&gt;
&lt;br /&gt;
    $ ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    enter 'test' for username and enter 'test' for password&lt;br /&gt;
&lt;br /&gt;
    //wait for servo to load successful response and then exit (make sure it is completely loaded before exiting or it may crash)&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory profile_dir that contains the credentials entered in json format&lt;br /&gt;
&lt;br /&gt;
    //now run servo again with the same arguments to see that the auth cache was written to file and then loaded from file&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    //The page should load with a success without needed any username or password this time&lt;br /&gt;
&lt;br /&gt;
    //you can try other urls that contain the other data ( cookies, hsts_list, local_data ) and close servo and look at the data written to the file (now all pages contain all data)&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102334</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102334"/>
		<updated>2016-04-26T21:31:04Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Gui testing for the entire project scope */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Decoding the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
==='''Gui testing for the entire project scope'''===&lt;br /&gt;
&lt;br /&gt;
    $ git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    $ cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    enter 'test' for username and enter 'test' for password&lt;br /&gt;
&lt;br /&gt;
    //wait for servo to load successful response and then exit (make sure it is completely loaded before exiting or it may crash)&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory profile_dir that contains the credentials entered in json format&lt;br /&gt;
&lt;br /&gt;
    //now run servo again with the same arguments to see that the auth cache was written to file and then loaded from file&lt;br /&gt;
&lt;br /&gt;
    $ ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    //The page should load with a success without needed any username or password this time&lt;br /&gt;
&lt;br /&gt;
    //you can try other urls that contain the other data ( cookies, hsts_list, local_data ) and close servo and look at the data written to the file (now all pages contain all data)&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102333</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102333"/>
		<updated>2016-04-26T21:28:26Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Decoding the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
==='''Gui testing for the entire project scope'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --release&lt;br /&gt;
&lt;br /&gt;
    ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    enter 'test' for username and enter 'test' for password&lt;br /&gt;
&lt;br /&gt;
    wait for servo to load successful response and then exit (make sure it is completely loaded before exiting or it may crash)&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory profile_dir that contains the credentials entered in json format&lt;br /&gt;
&lt;br /&gt;
    now run servo again with the same arguments to see that the auth cache was written to file and then loaded from file&lt;br /&gt;
&lt;br /&gt;
    ./mach run --release http://browserspy.dk/password-ok.php --profile-dir profile_dir&lt;br /&gt;
&lt;br /&gt;
    The page should load with a success without needed any username or password this time&lt;br /&gt;
&lt;br /&gt;
    you can try other urls that contain the other data ( cookies, hsts_list, local_data ) and close servo and look at the data written to the file (now all pages contain all data)&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102332</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102332"/>
		<updated>2016-04-26T21:22:13Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Subsequent Steps Pull Requests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Decoding the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102328</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102328"/>
		<updated>2016-04-26T18:09:14Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Deserializing the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102327</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102327"/>
		<updated>2016-04-26T18:08:39Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Deserializing the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if authorization credentials entered by user''' ===&lt;br /&gt;
The project maintainer instructed us to add a unit test that tests if a user entered the correct credentials on a 401 response that the correct basic authorization header is set.&lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102325</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102325"/>
		<updated>2016-04-26T09:10:09Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Deserializing the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102324</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102324"/>
		<updated>2016-04-26T09:07:28Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we have created the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
''' The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Initial_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we created a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We then first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we then display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we open or create a file for each data set we are saving.  After each file is opened or created we serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use is used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs is the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory is opened and deserialized using the serialize rust library. The data is then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
'''The Pull Requests for these steps can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Subsequent_Steps_Pull_Requests here]'''&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps and the subsequent steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
==='''Initial Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Subsequent Steps Pull Requests'''===&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the Final steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10328 401 authorization UI]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10661 Writing the serialized data in separate files inside the profile directory]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10800 Deserializing the data and populating the appropriate fields]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Testing the new command line flag --profile-dir'''===&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
=== '''Unit Test for set authorization header if url does not have credentials''' ===&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
=== '''GUI test for the tinyfiledialogs lib'''===&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
We have successfully completed all the steps mentioned in the [https://github.com/servo/servo/wiki/Persistent-sessions-student-project NCSU Student Projects Page]. All the Pull requests have been accepted and merged with the servo master branch. &lt;br /&gt;
&lt;br /&gt;
We have also created a [https://https://youtu.be/Lm-NZDOSK0Q Video] explaining our entire project&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102212</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102212"/>
		<updated>2016-04-12T02:24:57Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier we have completed the initial steps and they have been fully merged with the servo master branch.  We are in the process of completing the subsequent steps.  One pull request has been made and we are currently adding some changes to it in order to implement the first subsequent step &amp;quot;make an authorization UI appear when a 401 HTTP response is received &amp;quot;.  The pull request can be found [https://github.com/servo/servo/pull/10328 here].  We have also started work on the second step, however, have not made the second pull request yet.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102209</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102209"/>
		<updated>2016-04-12T02:22:10Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier we have completed the initial steps.  We are in the process of completing the subsequent steps.  One pull request has been made and we are in progress of fixing it to implement the first subsequent step &amp;quot;make an authorization UI appear when a 401 HTTP response is received &amp;quot;.  The pull request can be found [https://github.com/servo/servo/pull/10328 here].  We have also started work on the second step, however, have not made the second pull request yet.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102201</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102201"/>
		<updated>2016-04-12T02:17:01Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Previous Related Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102200</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102200"/>
		<updated>2016-04-12T02:16:51Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Previous Related Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_1 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_2 here]&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
The UML Diagram for this implementation can be found [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#UML_for_step_4 here]&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP2.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:STEP4.png ]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101926</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101926"/>
		<updated>2016-04-07T19:42:07Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
=='''UML for step 1'''==&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:517project.png&amp;diff=101925</id>
		<title>File:517project.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:517project.png&amp;diff=101925"/>
		<updated>2016-04-07T19:39:53Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: uploaded a new version of &amp;amp;quot;File:517project.png&amp;amp;quot;: r&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:517project.png&amp;diff=101924</id>
		<title>File:517project.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:517project.png&amp;diff=101924"/>
		<updated>2016-04-07T19:39:12Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101839</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101839"/>
		<updated>2016-04-04T22:13:56Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of this project is to:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
&lt;br /&gt;
4)&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101838</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101838"/>
		<updated>2016-04-04T22:11:42Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Design patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
This is a quick summary of the changes.  Not all code is shown. To see a more detailed view of the code changes look at the pull requests or commits in the repo.&lt;br /&gt;
&lt;br /&gt;
Note: Both the servo repo and the tinyfiledialogs repo have to be looked at to see the full scope of our project. The repo for the tinyfiledialogs is located at https://github.com/jdm/tinyfiledialogs&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
The repo to the tinyfiledialogs library and example the team created is located at https://github.com/jdm/tinyfiledialogs&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''GUI test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for tinyfiledialogs library.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101837</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101837"/>
		<updated>2016-04-04T22:11:22Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Design patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
This is a quick summary of the changes.  Not all code is shown. To see a more detailed view of the code changes look at the pull requests or commits in the repo.&lt;br /&gt;
&lt;br /&gt;
Note: Both the servo repo and the tinyfiledialogs repo have to be looked at to see the full scope of our project. The repo for the tinyfiledialogs is located at https://github.com/jdm/tinyfiledialogs&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
The repo to the tinyfiledialogs library and example the team created is located at https://github.com/jdm/tinyfiledialogs&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''GUI test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for tinyfiledialogs library.  We could have just called the FFI functions from servo, but instead we created a safe and simply interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101836</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101836"/>
		<updated>2016-04-04T22:10:34Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of this project is to:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
&lt;br /&gt;
4)&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for tinyfiledialogs library.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101835</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101835"/>
		<updated>2016-04-04T22:10:14Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of this project is to:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
&lt;br /&gt;
4)&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for tinyfiledialogs library.  We could have just called the FFI functions from servo, but instead we created a safe and simply interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101834</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101834"/>
		<updated>2016-04-04T22:09:43Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of this project is to:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
&lt;br /&gt;
4)&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around RUST FFI for tinyfiledialogs library.  We could have just called the FFI functions from servo, but instead we created a safe and simply interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101833</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101833"/>
		<updated>2016-04-04T22:04:50Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Implementation / Design Decisions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of this project is to:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
&lt;br /&gt;
4)&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101832</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101832"/>
		<updated>2016-04-04T21:51:11Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
This is a quick summary of the changes.  Not all code is shown. To see a more detailed view of the code changes look at the pull requests or commits in the repo.&lt;br /&gt;
&lt;br /&gt;
Note: Both the servo repo and the tinyfiledialogs repo have to be looked at to see the full scope of our project. The repo for the tinyfiledialogs is located at https://github.com/jdm/tinyfiledialogs&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
The repo to the tinyfiledialogs library and example the team created is located at https://github.com/jdm/tinyfiledialogs&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''GUI test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101831</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101831"/>
		<updated>2016-04-04T21:50:35Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Step 3: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
This is a quick summary of the changes.  Not all code is shown. To see a more detailed view of the code changes look at the pull requests or commits in the repo.&lt;br /&gt;
&lt;br /&gt;
Note: Both the servo repo and the tinyfiledialogs repo have to be looked at to see the full scope of our project. &lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
The repo to the tinyfiledialogs library and example the team created is located at https://github.com/jdm/tinyfiledialogs&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''GUI test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101830</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101830"/>
		<updated>2016-04-04T21:49:22Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
This is a quick summary of the changes.  Not all code is shown. To see a more detailed view of the code changes look at the pull requests or commits in the repo.&lt;br /&gt;
&lt;br /&gt;
Note: Both the servo repo and the tinyfiledialogs repo have to be looked at to see the full scope of our project. &lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''GUI test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101829</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101829"/>
		<updated>2016-04-04T21:46:49Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Step 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of this project is to:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
&lt;br /&gt;
4)&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: &lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective:&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101828</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101828"/>
		<updated>2016-04-04T21:45:55Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Step 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of this project is to:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
&lt;br /&gt;
4)&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: &lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective:&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101827</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101827"/>
		<updated>2016-04-04T21:45:29Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Step 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of this project is to:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
&lt;br /&gt;
4)&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the profile directory command-line option is present when the ResourceThread is instructed to exit, serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: &lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective:&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101826</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=101826"/>
		<updated>2016-04-04T21:34:42Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Step 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of this project is to:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
&lt;br /&gt;
4)&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: &lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: &lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective:&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101581</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101581"/>
		<updated>2016-04-01T18:07:15Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
This is a quick summary of the changes.  Not all code is shown. To see a more detailed view of the code changes look at the pull requests or commits in the repo.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''GUI test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101580</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101580"/>
		<updated>2016-04-01T18:05:17Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
This is quick summary of the changes.  Not all code is shown. To see a more detailed view of the code changes look at the pull requests or commits in the repo.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''GUI test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101546</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101546"/>
		<updated>2016-03-30T23:50:20Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Pull Request */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Requests''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''GUI test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101545</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101545"/>
		<updated>2016-03-30T23:49:30Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Gui test for the tinyfiledialogs lib */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''GUI test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101402</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101402"/>
		<updated>2016-03-28T19:23:47Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Testing the new command line flag --profile-dir */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Gui test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101397</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101397"/>
		<updated>2016-03-28T19:11:01Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Testing the new command line flag --profile-dir */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
&lt;br /&gt;
    cd servo&lt;br /&gt;
&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
&lt;br /&gt;
    //A new folder should be created if it does not exist with the directory name&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Gui test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101396</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101396"/>
		<updated>2016-03-28T19:08:30Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing the new command line flag --profile-dir'''==&lt;br /&gt;
    git clone https://github.com/servo/servo.git&lt;br /&gt;
    cd servo&lt;br /&gt;
    ./mach run tests/html/about-mozilla.html --profile-dir [directory name]&lt;br /&gt;
    A new folder should be created if it does not exist with the directory name&lt;br /&gt;
  &lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Gui test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101395</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101395"/>
		<updated>2016-03-28T18:59:55Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Gui test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101394</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101394"/>
		<updated>2016-03-28T18:58:20Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Unit Test for set authorization header from it if url does not have credentials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Gui test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101393</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101393"/>
		<updated>2016-03-28T18:57:57Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test for set authorization header from it if url does not have credentials''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Gui test for the tinyfiledialogs lib'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101392</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101392"/>
		<updated>2016-03-28T18:51:50Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Gui test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Gui test'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
    Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
    cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
    cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101391</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101391"/>
		<updated>2016-03-28T18:51:29Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Unit Test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
    ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Gui test'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101390</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101390"/>
		<updated>2016-03-28T18:49:26Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Gui test'''==&lt;br /&gt;
In addition to creating the rust FFI bindings for the tinyfiledialog C library our team also created a example rust program to test the new rust library.&lt;br /&gt;
&lt;br /&gt;
To run the example and see all of the tinyfiledialog windows do the following.&lt;br /&gt;
&lt;br /&gt;
Git clone https://github.com/jdm/tinyfiledialogs.git&lt;br /&gt;
&lt;br /&gt;
cd tinyfiledialogs/examples/tinytest&lt;br /&gt;
&lt;br /&gt;
cargo run&lt;br /&gt;
&lt;br /&gt;
This will run tinytest which is a rust program that show cases the different GUI windows that the new rust tinyfiledialogs library has.&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101387</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101387"/>
		<updated>2016-03-28T18:43:56Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Unit Test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test''' ==&lt;br /&gt;
The project maintainer instructed us to add one unit test to test the initial step functionality.  We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command &lt;br /&gt;
&lt;br /&gt;
./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101361</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101361"/>
		<updated>2016-03-24T21:08:38Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Pull Request */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test''' ==&lt;br /&gt;
We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests that fully implement the initial steps have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101360</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101360"/>
		<updated>2016-03-24T21:07:32Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Design patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test''' ==&lt;br /&gt;
We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101359</id>
		<title>CSC/ECE 517 Spring 2016 OSS M1606</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_OSS_M1606&amp;diff=101359"/>
		<updated>2016-03-24T21:07:09Z</updated>

		<summary type="html">&lt;p&gt;Dedefish: /* Design patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[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.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README 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.&lt;br /&gt;
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.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' == &lt;br /&gt;
&lt;br /&gt;
The scope of the project is limited to the steps mentioned below:&lt;br /&gt;
&lt;br /&gt;
1) Compile Servo and ensure that it runs on &amp;lt;code&amp;gt;tests/html/about-mozilla.html&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
2) Add a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creating the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
3) Create [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
5) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implement the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: === &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To create the Rust FFI bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library so as to allow the C methods to be called from Servo.&lt;br /&gt;
&lt;br /&gt;
An example program that uses the tinyfiledialogs bindings has been placed in /examples/tinytest&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the file &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, we were required to define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member. &lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In the&amp;lt;code&amp;gt; modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, we were required to implement a portion of the appropriate specification using this new authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Unit Test''' ==&lt;br /&gt;
We have added a unit test to test that the authentication header is being set if credentials are contained in the cache &lt;br /&gt;
&lt;br /&gt;
It can be run with the other unit tests with the command ./mach test-unit -p net&lt;br /&gt;
&lt;br /&gt;
The unit test can be found in /servo/tests/unit/net/http_loader.rs&lt;br /&gt;
&lt;br /&gt;
== '''Pull Request''' ==&lt;br /&gt;
All pull requests have been accepted by a servo maintainer and successfully merged to the servo master branch&lt;br /&gt;
&lt;br /&gt;
These are the pull requests that complete the initial steps of the project:&lt;br /&gt;
&lt;br /&gt;
1)    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10087 Added a new command line flag --profile-dir ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/jdm/tinyfiledialogs/pull/1 Added Rust FFI bindings to lib.rs ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3)	&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/pull/10111 Added authorization cache to resources &amp;amp; set authorization header from it if url does not have credentials ]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Design patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design in [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
&lt;br /&gt;
The definition of the HTTP authorization cache and the implementation of the appropriate specification in the &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, ensures the authorization UI will appear when a 401 HTTP response is received. &lt;br /&gt;
&lt;br /&gt;
The Rust FFI Bindings for the &amp;lt;code&amp;gt;tinyfiledialogs&amp;lt;/code&amp;gt; library will ultimately help with the dialogue box that will pop up in event of a 401 HTTP response. &lt;br /&gt;
&lt;br /&gt;
The&amp;lt;code&amp;gt; –profile-dir [path]&amp;lt;/code&amp;gt; command line flag will store an optional directory path, creating the directory in case it doesn’t exist.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dedefish</name></author>
	</entry>
</feed>