[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #43771] NSURLConnection making synchronous request can't authentica
From: |
Sergei Golovin |
Subject: |
[bug #43771] NSURLConnection making synchronous request can't authenticate using URL's credential |
Date: |
Sun, 07 Dec 2014 11:13:28 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0 |
URL:
<http://savannah.gnu.org/bugs/?43771>
Summary: NSURLConnection making synchronous request can't
authenticate using URL's credential
Project: GNUstep
Submitted by: svg
Submitted on: Sun 07 Dec 2014 03:13:27 PM SAMT
Category: Base/Foundation
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
If you run under a debugger the tool 'test06' (from the attached patch)
with a breakpoint on the line NSURLConnection.m:267 then you will get
the following frame:
----------------------------------------------------
Breakpoint 1, -[NSObject(NSURLConnectionDelegate)
connection:didReceiveAuthenticationChallenge:] (self=0x7367b0,
_cmd=0x7ffff7d8b9f0 <_OBJC_SELECTOR_TABLE+688>, connection=0x737220,
challenge=0x7f38f0) at NSURLConnection.m:267
(gdb) l
262 }
263
264 - (void) connection: (NSURLConnection *)connection
265 didReceiveAuthenticationChallenge: (NSURLAuthenticationChallenge
*)challenge
266 {
267 [[challenge sender]
268 continueWithoutCredentialForAuthenticationChallenge: challenge];
269 }
270
271 - (void) connection: (NSURLConnection *)connection
----------------------------------------------------
In this method the code logic commands to continue without a credential.
It doesn't make a check on whether there is a proposed credential or
the failure count. However if you climb up 2 frames then you will get to:
----------------------------------------------------
#2 0x00007ffff7908bda in -[_NSHTTPURLProtocol _got:] (self=0x780bb0,
_cmd=0x7ffff7d92720 <_OBJC_SELECTOR_TABLE+2144>,
stream=0x783ad0) at NSURLProtocol.m:1163
----------------------------------------------------
then there before entering into:
----------------------------------------------------
[this->client URLProtocol: self
=> didReceiveAuthenticationChallenge: _challenge];
----------------------------------------------------
is the code chunk which makes a proposed credential from the request's URL:
----------------------------------------------------
_credential = [[NSURLCredential alloc]
initWithUser: [url user]
password: [url password]
persistence: NSURLCredentialPersistenceForSession];
....
....
_challenge = [[NSURLAuthenticationChallenge alloc]
initWithProtectionSpace: space
proposedCredential: _credential
previousFailureCount: failures
failureResponse: _response
error: nil
sender: self];
----------------------------------------------------
So currently if the library user provides a valid credential in the URL (e.g.
"http://login:password@localhost:54321") it wouldn't be used. Synchronous
requests to such a URL will fail.
The attached patch's summary:
* Source/NSURLConnection.m:
- fixed a bug... NSURLConnection couldn't make synchronous load
using URL's credential;
* Tests/base/NSURLConnection/test06.m:
- added a new test on synchronous load with authentication by
URL's credential;
* Tests/base/NSURLConnection/Helpers/RequestHandler.m:
- fixed a bug.... the Handler200 didn't supply a valid status line;
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sun 07 Dec 2014 03:13:27 PM SAMT Name:
NSURLConnection_synchro_with_auth.patch Size: 4kB By: svg
<http://savannah.gnu.org/bugs/download.php?file_id=32615>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?43771>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #43771] NSURLConnection making synchronous request can't authenticate using URL's credential,
Sergei Golovin <=