mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fixup debug logging of http requests with authentication
This commit is contained in:
parent
e835725b86
commit
abd5223579
3 changed files with 35 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2022-07-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSHTTPURLHandle.m:
|
||||
* Source/NSURLProtocol.m:
|
||||
Include body after masked headers in debug output.
|
||||
|
||||
2022-05-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
Changes to remove sensitive information from debug logs.
|
||||
|
|
|
@ -593,6 +593,10 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSEndMapTableEnumeration(&enumerator);
|
||||
|
||||
[buf appendBytes: "\r\n" length: 2];
|
||||
if (masked)
|
||||
{
|
||||
[masked appendBytes: "\r\n" length: 2];
|
||||
}
|
||||
|
||||
/*
|
||||
* Append any data to be sent
|
||||
|
@ -600,6 +604,10 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
if (wData != nil)
|
||||
{
|
||||
[buf appendData: wData];
|
||||
if (masked)
|
||||
{
|
||||
[masked appendData: wData];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1732,6 +1732,7 @@ typedef struct {
|
|||
NSString *s;
|
||||
NSURL *u;
|
||||
int l;
|
||||
NSData *bytes;
|
||||
|
||||
if (_debug)
|
||||
{
|
||||
|
@ -1825,6 +1826,10 @@ typedef struct {
|
|||
static char *ct
|
||||
= "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||
[m appendBytes: ct length: strlen(ct)];
|
||||
if (mm)
|
||||
{
|
||||
[mm appendBytes: ct length: strlen(ct)];
|
||||
}
|
||||
}
|
||||
if ([this->request valueForHTTPHeaderField: @"Host"] == nil)
|
||||
{
|
||||
|
@ -1854,15 +1859,29 @@ typedef struct {
|
|||
{
|
||||
s = [NSString stringWithFormat: @"Host: %@:%@\r\n", h, p];
|
||||
}
|
||||
[m appendData: [s dataUsingEncoding: NSASCIIStringEncoding]];
|
||||
bytes = [s dataUsingEncoding: NSASCIIStringEncoding];
|
||||
[m appendData: bytes];
|
||||
if (mm)
|
||||
{
|
||||
[mm appendData: bytes];
|
||||
}
|
||||
}
|
||||
if (l >= 0 && [this->request
|
||||
valueForHTTPHeaderField: @"Content-Length"] == nil)
|
||||
{
|
||||
s = [NSString stringWithFormat: @"Content-Length: %d\r\n", l];
|
||||
[m appendData: [s dataUsingEncoding: NSASCIIStringEncoding]];
|
||||
bytes = [s dataUsingEncoding: NSASCIIStringEncoding];
|
||||
[m appendData: bytes];
|
||||
if (mm)
|
||||
{
|
||||
[mm appendData: bytes];
|
||||
}
|
||||
}
|
||||
[m appendBytes: "\r\n" length: 2]; // End of headers
|
||||
if (mm)
|
||||
{
|
||||
[mm appendBytes: "\r\n" length: 2];
|
||||
}
|
||||
_writeData = m;
|
||||
ASSIGN(_masked, mm);
|
||||
} // Fall through to do the write
|
||||
|
|
Loading…
Reference in a new issue