Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headers not sent when pullReplication.Continuous = true #796

Closed
hackily opened this issue Jan 6, 2017 · 4 comments
Closed

Headers not sent when pullReplication.Continuous = true #796

hackily opened this issue Jan 6, 2017 · 4 comments
Labels
Milestone

Comments

@hackily
Copy link
Contributor

hackily commented Jan 6, 2017

If I'm approaching this the wrong way, let me know!

I have yet to work out the details regarding the sync gateway OpenID Connect implicit flow and getting an ID token, but maybe I should? Anyhow...

Background:
I need to send an auth token in the header with every HTTP request I make to the sync gateway.
Otherwise, I'll get 401s.
(Not sure how the ID token will play into that, the sync gateway is protected a behind a UAA service)

Replication pull = database.CreatePullReplication(uriBuilder.Uri);
pull.Headers.Add("Authorization", "bearer " + accessToken);
pull.Continuous = true;
pull.Start();

If pull.Continuous = true, the trace shows that the headers I added are missing:

System.Net Information: 0 : [18636] ConnectStream#44780731 - Sending headers
{
Host: 8khg90.run.asv-pr.ice.predix.io
Connection: Keep-Alive
}.

---- removed certificate verification details----

System.Net Information: 0 : [18636] SecureChannel#1867017 - Remote certificate was verified as valid by the user.
System.Net Information: 0 : [18636] ProcessAuthentication(Protocol=Tls12, Cipher=Aes256 256 bit strength, Hash=32781 0 bit strength, Key Exchange=RsaKeyX 4096 bit strength).
System.Net Information: 0 : [18636] Connection#7588182 - Received status line: Version=1.1, StatusCode=401, StatusDescription=Unauthorized.
System.Net Information: 0 : [18636] Connection#7588182 - Received headers

On the other hand, when pull.Continuous = false :

System.Net Information: 0 : [28648] ConnectStream#13726014 - Sending headers
{
Connection: keep-alive
User-Agent: CouchbaseLite/1.3 (.NET Microsoft Windows 8.1 Pro/x64 1.4-b014/d550c7d)
Authorization: bearer <token redacted>
}
---- removed certificate verification details----
System.Net Information: 0 : [28648] SecureChannel#62474978 - Remote certificate was verified as valid by the user.
System.Net Information: 0 : [28648] EndProcessAuthentication(Protocol=Tls12, Cipher=Aes256 256 bit strength, Hash=32781 0 bit strength, Key Exchange=RsaKeyX 4096 bit strength).
System.Net Information: 0 : [18508] Connection#26314214 - Received status line: Version=1.1, StatusCode=200, StatusDescription=OK.
System.Net Information: 0 : [18508] Connection#26314214 - Received headers
{
Content-Encoding: gzip
Instance: 0
X-Vcap-Request-Id: 7c79b154-887f-4ca7-711a-4ea549331e6a
Content-Length: 310
Cache-Control: private, max-age=0, no-cache, no-store
Content-Type: application/json
Date: Fri, 06 Jan 2017 16:58:04 GMT
Set-Cookie: TS0199fba1=0118c62c55abd72d47d10707165675317a83d9f0496c633ad15bf619ece6cbd9e822ce915b7685e9672ecb49fa7a963d07a297ad87; Path=/; Domain=.predix.io
}.

System.Net Information: 0 : [18508] ConnectStream#6451435::ConnectStream(Buffered 310 bytes.)
System.Net Information: 0 : [18508] Associating HttpWebRequest#19420176 with ConnectStream#6451435
System.Net Information: 0 : [18508] Associating HttpWebRequest#19420176 with HttpWebResponse#26998456
System.Net Information: 0 : [18508] ContentLength=-1
System.Net Information: 0 : [20400] Associating HttpWebRequest#60644701 with ServicePoint#42194754
System.Net Information: 0 : [20400] Associating Connection#26314214 with HttpWebRequest#60644701
System.Net Information: 0 : [20400] Associating HttpWebRequest#60644701 with ConnectStream#13273752
System.Net Information: 0 : [20400] HttpWebRequest#60644701 - Request: PUT /pg/api/admin/data/pm/_local/0e0fc66a0677aff4991ab9ffc3910f96b89eeb9d HTTP/1.1
System.Net Information: 0 : [20400] ConnectStream#13273752 - Sending headers
{
Connection: keep-alive
Accept: multipart/related, application/json
User-Agent: CouchbaseLite/1.3 (.NET Microsoft Windows 8.1 Pro/x64 1.4-b014/d550c7d)
Authorization: bearer <redacted token>
System.Net Information: 0 : [28648] Connection#26314214 - Received status line: Version=1.1, StatusCode=100, StatusDescription=Continue.
System.Net Information: 0 : [28648] Connection#26314214 - Received headers

Multiple HTTP calls are able to made correctly.

Admittedly, I am using a beta build, but I couldn't get this far with 1.3.1 :)

@djpongh djpongh added this to the 1.4.0 milestone Jan 6, 2017
@borrrden
Copy link
Member

borrrden commented Jan 6, 2017

Well, if it is working with non-continuous and not with continuous that's definitely a problem. This shouldn't be hard to repro and fix though. I'll update after I reproduce it.

borrrden added a commit that referenced this issue Jan 7, 2017
Closes #776
@borrrden
Copy link
Member

borrrden commented Jan 7, 2017

The web socket change tracker was not passing the headers from the puller along. This has been fixed now.

@borrrden
Copy link
Member

borrrden commented Jan 7, 2017

P.S. We have some helper stuff for OpenID Connect. You can see details about it here.

@hackily
Copy link
Contributor Author

hackily commented Jan 7, 2017

Awesome, thanks for the quick support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants