Fixup key name that I advised on incorrectly - needs the correct prefix.

This commit is contained in:
rfm 2025-03-26 16:16:57 +00:00
parent 62ab252a3f
commit ce9699d5c5
5 changed files with 34 additions and 24 deletions

View file

@ -3,9 +3,13 @@
* Sources/externs.m:
* Source/GSHTTPURLHandle.m:
* Source/NSURLProtocol.m:
Updates `Authorization` header generation to include the query parameters (if present).
Updates 'Authorization' header generation to include the query
parameters (if present).
Brings the implementation inline with MacOS.
Also adds the `GSDigestURIOmitsQuery` key for use with ` -[NSHTTPURLHandle writeProperty:forKey:]` / `+[NSURLProtocol setProperty:forKey:inRequest:]` to toggle off this updated behavior.
Also adds the 'GSHTTPPropertyDigestURIOmitsQuery' key for use with
'-[NSHTTPURLHandle writeProperty:forKey:]' or
'+[NSURLProtocol setProperty:forKey:inRequest:]' to toggle off this
updated behavior.
2025-03-08 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -116,11 +116,11 @@ GS_EXPORT NSString * const GSHTTPPropertyPasswordKey;
/**
* Key for passing to [NSURLHandle]'s and [NSHTTPURLProtocol]'s
* <code>propertyForKey..</code> methods. Specifying <code>@YES</code> will
* <code>propertyForKey..</code> methods. Specifying <code>YES</code> will
* signal Digest Authentication logic to always omit the 'query' portion of the
* URI when generating the `Authorization` header.
*/
GS_EXPORT NSString * const GSDigestURIOmitsQuery;
GS_EXPORT NSString * const GSHTTPPropertyDigestURIOmitsQuery;
#endif

View file

@ -574,15 +574,17 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
}
}
omitQuery = [request objectForKey:GSDigestURIOmitsQuery];
omitQuery = [request objectForKey:
GSHTTPPropertyDigestURIOmitsQuery];
if ([[u query] length] == 0 || [omitQuery boolValue])
{
path = [u pathWithEscapes];
}
else
{
path = [NSString stringWithFormat:@"%@?%@", [u pathWithEscapes], [u query]];
}
path = [u pathWithEscapes];
}
else
{
path = [NSString stringWithFormat: @"%@?%@",
[u pathWithEscapes], [u query]];
}
auth = [authentication authorizationForAuthentication: nil
method: method
@ -905,15 +907,17 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
}
}
omitQuery = [request objectForKey:GSDigestURIOmitsQuery];
omitQuery = [request objectForKey:
GSHTTPPropertyDigestURIOmitsQuery];
if ([[url query] length] == 0 || [omitQuery boolValue])
{
path = [url pathWithEscapes];
}
else
{
path = [NSString stringWithFormat:@"%@?%@", [url pathWithEscapes], [url query]];
}
{
path = [url pathWithEscapes];
}
else
{
path = [NSString stringWithFormat: @"%@?%@",
[url pathWithEscapes], [url query]];
}
auth = [authentication authorizationForAuthentication: ac
method: method

View file

@ -1411,13 +1411,15 @@ typedef struct {
/* Generate authentication header value for the
* authentication type in the challenge.
*/
omitQuery = [this->request _propertyForKey:GSDigestURIOmitsQuery];
omitQuery = [this->request _propertyForKey:
GSHTTPPropertyDigestURIOmitsQuery];
auth = [authentication
authorizationForAuthentication: hdr
method: [this->request HTTPMethod]
path: [[url query] length] == 0 || [omitQuery boolValue] ?
[url pathWithEscapes] :
[NSString stringWithFormat:@"%@?%@", [url pathWithEscapes], [url query]]
path: [[url query] length] == 0 || [omitQuery boolValue]
? [url pathWithEscapes]
: [NSString stringWithFormat: @"%@?%@",
[url pathWithEscapes], [url query]]
];
}

View file

@ -562,7 +562,7 @@ GS_DECLARE NSString* const GSHTTPPropertyProxyPortKey = @"GSHTTPPropertyProxyPor
GS_DECLARE NSString* const GSHTTPPropertyCertificateFileKey = @"GSHTTPPropertyCertificateFileKey";
GS_DECLARE NSString* const GSHTTPPropertyKeyFileKey = @"GSHTTPPropertyKeyFileKey";
GS_DECLARE NSString* const GSHTTPPropertyPasswordKey = @"GSHTTPPropertyPasswordKey";
GS_DECLARE NSString* const GSDigestURIOmitsQuery = @"GSDigestURIOmitsQuery";
GS_DECLARE NSString* const GSHTTPPropertyDigestURIOmitsQuery = @"GSHTTPPropertyDigestURIOmitsQuery";
/* NSURLProtectionSpace */
GS_DECLARE NSString* const NSURLProtectionSpaceFTPProxy = @"ftp";