Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Relay prototype #5

Merged
merged 81 commits into from
Jul 22, 2014
Merged

Relay prototype #5

merged 81 commits into from
Jul 22, 2014

Conversation

stefangordon
Copy link

Considering getting this simple relay implementation into ThaliProject while I finish up the other aspects of it - to simplify folks using the HTML5 seed. Perhaps into a new branch on ThaliProject - but then you wouldn't be able to see the diff for review.

Only one source file here for the relay - RelayWebServer.java (and RelayWebServerTest.java). The other bits are all NanoHTTPD. Open questions on code file headers for those....

ccoenraets and others added 30 commits November 5, 2013 13:08
- Hardware Acceleration on transitions
to build them back up.
Next step: converting to pouchdb.
Almost wrapping up the full cycle.
I have to remember micro commits!
Two bugs:
1) Not turning off camera after saving new contact
2) Not rendering QR code on detail page yet

Two things not finished:
1) Edit existing contact
2) Deleting contact
Updating read me next
// Copy response headers to relayed response
// Enable chunked transfer where appropriate and ignore date header
// as NanoHTTPD adds this for us
for(Header responseHeader : httpResponse.getAllHeaders()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per https://www.mnot.net/blog/2011/07/11/what_proxies_must_do

"This means that the Connection header and any header it lists MUST be removed, as well as TE, Transfer-Encoding, Keep-Alive, Proxy-Authorization, Proxy-Authentication, Trailer and Upgrade."

So please remove those headers.

@stefangordon
Copy link
Author

Alright, this is much better now (not good, but much better). Github seems unsure of what to do with comments when the code they were placed in went away. Major changes are leveraging GetLocalCouchInstance, status class, better error handling (http responses at least) and PPNet actually working.

Ugly bit is that we still use NanoHTTPD's body parsing which makes it difficult to not push the body through a string (for post at least) - Looking at this next.

@stefangordon
Copy link
Author

Alright, eliminated conversion to string in both directions. It is not ideal as its buffered, but it is the easiest solution for now and seems to work great.

// Set max connections for this route (Default is 2)
//ThreadSafeClientConnManager cm = (ThreadSafeClientConnManager)httpClient.getConnectionManager();
//cm.setMaxTotal(20);
//cm.setMaxForRoute(new HttpRoute(httpHost, null, false), 20);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the commented code above just be deleted?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigh. yes. Can't believe I'm that guy who leaves commented code in his commits now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not even going to start to admitting how many times I've done that. That's why code reviews are useful. After awhile you just can't 'see' your code anymore.

yaronyg added a commit that referenced this pull request Jul 22, 2014
@yaronyg yaronyg merged commit 0e74efa into thaliproject:master Jul 22, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants