couchbase / couchbase-lite-ios

Lightweight, embedded, syncable NoSQL database engine for iOS and MacOS apps.
Apache License 2.0
1.62k stars 297 forks source link

Technical Help - URLProtocol #1489

Closed msanilkumar2020 closed 7 years ago

msanilkumar2020 commented 7 years ago

Hi,

In CBLURLProtocol,

I have a requirement to intercept this request and pass it to wolfssl to make it FIPS compliant.

If i try to intercept, i am getting only "http://lite.couchbase./ptxdata/" not with actual host name and path.

Can you please suggest a way to get the proper constructed request.

EX : <NSMutableURLRequest: 0x174406950> { URL: http://lite.couchbase./ABC/_design/abc }

I tried with sample app, it is working, in CBL i am getting wrong intercepted URL.

Thanks, Anil Kumar

snej commented 7 years ago

I have a requirement to intercept this request and pass it to wolfssl to make it FIPS compliant.

Why? It isn't being sent over the network. NSURLProtocol is just a hook to handle in-process HTTP requests made by PhoneGap apps.

(BOOL)canInitWithRequest:(NSURLRequest *)request should return actual request

It doesn't return any request, it returns a BOOL, so I'm not sure what you're asking. (Are you familiar with what NSURLProtocol does?)

msanilkumar2020 commented 7 years ago

It doesn't return any request, it returns a BOOL, so I'm not sure what you're asking. (Are you familiar with what NSURLProtocol does?) - it doesn't return any value even i am aware of it, but it provide current request we can tweak.

If we return NO in canInitWithRequest it will hit start and stop loading method. Here we can start our own request and return back data to original request.