@@ -114,7 +114,7 @@ public class HttpIncomingDataPorcessor: Hashable, IncomingDataProcessor {
114114 case . waitingForHeaders:
115115
116116 guard self . buffer. count + chunk. count < 4096 else {
117- throw SwifterError . parse ( " Headers size exceeds the limit. " )
117+ throw SwifterError . httpError ( " Headers size exceeds the limit. " )
118118 }
119119
120120 var iterator = chunk. makeIterator ( )
@@ -137,7 +137,7 @@ public class HttpIncomingDataPorcessor: Hashable, IncomingDataProcessor {
137137 case . waitingForBody:
138138
139139 guard self . request. body. count + chunk. count <= request. contentLength else {
140- throw SwifterError . parse ( " Peer sent more data then required ('Content-Length' = \( request. contentLength) . " )
140+ throw SwifterError . httpError ( " Peer sent more data then required ('Content-Length' = \( request. contentLength) . " )
141141 }
142142
143143 request. body. append ( contentsOf: chunk)
@@ -170,7 +170,7 @@ public class HttpIncomingDataPorcessor: Hashable, IncomingDataProcessor {
170170 } else if requestLineTokens [ 2 ] == [ 0x48 , 0x54 , 0x54 , 0x50 , 0x2f , 0x31 , 0x2e , 0x31 ] {
171171 request. httpVersion = . http11
172172 } else {
173- throw SwifterError . parse ( " Invalid http version: \( requestLineTokens [ 2 ] ) " )
173+ throw SwifterError . httpError ( " Invalid http version: \( requestLineTokens [ 2 ] ) " )
174174 }
175175
176176 request. headers = lines
@@ -190,19 +190,19 @@ public class HttpIncomingDataPorcessor: Hashable, IncomingDataProcessor {
190190 . filter ( { $0. 0 == " content-length " } )
191191 . first {
192192 guard let contentLength = Int ( value) else {
193- throw SwifterError . parse ( " Invalid 'Content-Length' header value \( value) . " )
193+ throw SwifterError . httpError ( " Invalid 'Content-Length' header value \( value) . " )
194194 }
195195 request. contentLength = contentLength
196196 }
197197
198198 guard let method = String ( bytes: requestLineTokens [ 0 ] , encoding: . ascii) else {
199- throw SwifterError . parse ( " Invalid 'method' value \( requestLineTokens [ 0 ] ) . " )
199+ throw SwifterError . httpError ( " Invalid 'method' value \( requestLineTokens [ 0 ] ) . " )
200200 }
201201
202202 request. method = method
203203
204204 guard let path = String ( bytes: requestLineTokens [ 1 ] , encoding: . ascii) else {
205- throw SwifterError . parse ( " Invalid 'path' value \( requestLineTokens [ 1 ] ) . " )
205+ throw SwifterError . httpError ( " Invalid 'path' value \( requestLineTokens [ 1 ] ) . " )
206206 }
207207
208208 let queryComponents = path. components ( separatedBy: " ? " )
0 commit comments