Parse the URI and pass the uriSearchAndHash into ContentClosure so it is preserved when the address bar is updated.
diff --git a/js/ccnxProtocol/components/ccnxProtocolService.js b/js/ccnxProtocol/components/ccnxProtocolService.js
index f5d526d..afd493b 100644
--- a/js/ccnxProtocol/components/ccnxProtocolService.js
+++ b/js/ccnxProtocol/components/ccnxProtocolService.js
@@ -36,18 +36,19 @@
     {

         var thisCcnxProtocol = this;

         

-        try {

-            var trimmedSpec = aURI.spec.trim();

+        try {            

+            var spec = aURI.spec.trim();

+            var preHash = spec.split('#', 1)[0];

+            var hash = spec.substr(preHash.length, spec.length).trim();

+            var preSearch = preHash.split('?', 1)[0];

+            var search = preHash.substr(preSearch.length, spec.length).trim();

+            // Set nameString to the preSearch without the protocol.

+            var nameString = preSearch.trim();

+            if (nameString.indexOf(':') >= 0)

+                nameString = nameString.substr(nameString.indexOf(':') + 1, spec.length).trim();

     

             var contentChannel;

-            var requestContent = function(contentListener) {

-                // Set nameString to the URI without the protocol.

-                var nameString = trimmedSpec;

-                var colonIndex = nameString.indexOf(':');

-                if (colonIndex >= 0)

-                    nameString = nameString.substr

-                        (colonIndex + 1, nameString.length - colonIndex - 1).trim();

-                

+            var requestContent = function(contentListener) {                

                 var name = new Name(nameString);

                 // TODO: Strip off an ending implicit digest before checking the last component?

                 var uriEndsWithSegmentNumber = endsWithSegmentNumber(name);

@@ -56,7 +57,8 @@
                       // Use the same transport object each time.

                       getTransport: function() { return thisCcnxProtocol.transport; } });

                 ndn.expressInterest(name, new ContentClosure

-                    (ndn, contentListener, uriEndsWithSegmentNumber, aURI.originCharset));

+                    (ndn, contentListener, uriEndsWithSegmentNumber, aURI.originCharset,

+                     search + hash));

             };

 

             contentChannel = new ContentChannel(aURI, requestContent);

@@ -83,9 +85,11 @@
  * uriEndsWithSegmentNumber is true if the URI passed to newChannel has a segment number

  *    (used to determine whether to request only that segment number and for updating the URL bar).

  * uriOriginCharset is the charset of the URI passed to newChannel (used for making a new URI)

+ * uriSearchAndHash is the search and hash part of the URI passed to newChannel, including the '?'

+ *    and/or '#' but without the interest selector fields.

  */                                                

 var ContentClosure = function ContentClosure

-        (ndn, contentListener, uriEndsWithSegmentNumber, uriOriginCharset) {

+        (ndn, contentListener, uriEndsWithSegmentNumber, uriOriginCharset, uriSearchAndHash) {

     // Inherit from Closure.

     Closure.call(this);

     

@@ -93,6 +97,8 @@
     this.contentListener = contentListener;

     this.uriEndsWithSegmentNumber = uriEndsWithSegmentNumber;

     this.uriOriginCharset = uriOriginCharset;

+    this.uriSearchAndHash = uriSearchAndHash;

+    

     this.firstReceivedSegmentNumber = null;

     this.firstReceivedContentObject = null;

 }

@@ -142,6 +148,9 @@
         else

             contentUriSpec = "ccnx:" + contentObject.name.to_uri();

     

+        // Include the search and hash.

+        contentUriSpec += this.uriSearchAndHash;

+    

         var contentTypeEtc = getNameContentTypeAndCharset(contentObject.name);

         var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);

         this.contentListener.onStart(contentTypeEtc.contentType, contentTypeEtc.contentCharset, 

@@ -191,8 +200,7 @@
         

     return Closure.RESULT_OK;

 };

-            

- 

+             

 /*

  * Scan the name from the last component to the first (skipping special CCNx components)

  *   for a recognized file name extension, and return an object with properties contentType and charset.