ObjFW  Diff

Differences From Artifact [f5ef5b6f99]:

To Artifact [771a949bd6]:

  • File src/OFHTTPClient.m — part of check-in [12c09ef41e] at 2023-10-15 14:55:50 on branch trunk — Add OFHTTPRequestMethodString()

    This deprecates OFHTTPRequestMethodName(), which returns a C string.
    APIs should avoid C strings as much as possible.

    This function was initially only used internally, where this was fine.
    However, when it was made public, it should have been converted to
    OFString at the same time.

    Adds OFHTTPRequestMethodParseString() for consistency, which behaves the
    same as OFHTTPRequestMethodParseName() and deprecates it. (user: js, size: 30943) [annotate] [blame] [check-ins using] [more...]


128
129
130
131
132
133
134
135

136
137
138
139
140
141
142
128
129
130
131
132
133
134

135
136
137
138
139
140
141
142







-
+








	if (IRI.path.length > 0)
		path = IRI.percentEncodedPath;
	else
		path = @"/";

	requestString = [OFMutableString stringWithFormat:
	    @"%s %@", OFHTTPRequestMethodName(method), path];
	    @"%@ %@", OFHTTPRequestMethodString(method), path];

	if (IRI.query != nil) {
		[requestString appendString: @"?"];
		[requestString appendString: IRI.percentEncodedQuery];
	}

	[requestString appendString: @" HTTP/"];
1064
1065
1066
1067
1068
1069
1070
1071

1072
1073

1074
1075
1076
1077
1078
1079
1080
1064
1065
1066
1067
1068
1069
1070

1071
1072

1073
1074
1075
1076
1077
1078
1079
1080







-
+

-
+







	if (_stream == nil)
		return -1;

	return ((OFStream <OFReadyForReadingObserving> *)_stream)
	    .fileDescriptorForReading;
}

- (bool)hasDataInReadBuffer
- (bool)lowlevelHasDataInReadBuffer
{
	return (super.hasDataInReadBuffer || _stream.hasDataInReadBuffer);
	return _stream.hasDataInReadBuffer;
}

- (void)close
{
	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];