@@ -36,10 +36,15 @@ pub(crate) enum Kind {
36
36
/// Error occurred while connecting.
37
37
Connect ,
38
38
/// Error creating a TcpListener.
39
- #[ cfg( all( any( feature = "http1" , feature = "http2" ) , feature = "tcp" ) ) ]
39
+ #[ cfg( all(
40
+ any( feature = "http1" , feature = "http2" ) ,
41
+ feature = "tcp" ,
42
+ feature = "server"
43
+ ) ) ]
40
44
Listen ,
41
45
/// Error accepting on an Incoming stream.
42
46
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
47
+ #[ cfg( feature = "server" ) ]
43
48
Accept ,
44
49
/// Error while reading a body from connection.
45
50
#[ cfg( any( feature = "http1" , feature = "http2" , feature = "stream" ) ) ]
@@ -77,6 +82,7 @@ pub(crate) enum User {
77
82
Body ,
78
83
/// Error calling user's MakeService.
79
84
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
85
+ #[ cfg( feature = "server" ) ]
80
86
MakeService ,
81
87
/// Error from future of user's Service.
82
88
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
@@ -85,6 +91,7 @@ pub(crate) enum User {
85
91
///
86
92
/// For example, sending both `content-length` and `transfer-encoding`.
87
93
#[ cfg( feature = "http1" ) ]
94
+ #[ cfg( feature = "server" ) ]
88
95
UnexpectedHeader ,
89
96
/// User tried to create a Request with bad version.
90
97
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
@@ -96,6 +103,7 @@ pub(crate) enum User {
96
103
UnsupportedRequestMethod ,
97
104
/// User tried to respond with a 1xx (not 101) response code.
98
105
#[ cfg( feature = "http1" ) ]
106
+ #[ cfg( feature = "server" ) ]
99
107
UnsupportedStatusCode ,
100
108
/// User tried to send a Request with Client with non-absolute URI.
101
109
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
@@ -178,6 +186,7 @@ impl Error {
178
186
}
179
187
180
188
#[ cfg( feature = "http1" ) ]
189
+ #[ cfg( feature = "server" ) ]
181
190
pub ( crate ) fn kind ( & self ) -> & Kind {
182
191
& self . inner . kind
183
192
}
@@ -234,11 +243,13 @@ impl Error {
234
243
}
235
244
236
245
#[ cfg( all( any( feature = "http1" , feature = "http2" ) , feature = "tcp" ) ) ]
246
+ #[ cfg( feature = "server" ) ]
237
247
pub ( crate ) fn new_listen < E : Into < Cause > > ( cause : E ) -> Error {
238
248
Error :: new ( Kind :: Listen ) . with ( cause)
239
249
}
240
250
241
251
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
252
+ #[ cfg( feature = "server" ) ]
242
253
pub ( crate ) fn new_accept < E : Into < Cause > > ( cause : E ) -> Error {
243
254
Error :: new ( Kind :: Accept ) . with ( cause)
244
255
}
@@ -272,6 +283,7 @@ impl Error {
272
283
}
273
284
274
285
#[ cfg( feature = "http1" ) ]
286
+ #[ cfg( feature = "server" ) ]
275
287
pub ( crate ) fn new_user_header ( ) -> Error {
276
288
Error :: new_user ( User :: UnexpectedHeader )
277
289
}
@@ -289,6 +301,7 @@ impl Error {
289
301
}
290
302
291
303
#[ cfg( feature = "http1" ) ]
304
+ #[ cfg( feature = "server" ) ]
292
305
pub ( crate ) fn new_user_unsupported_status_code ( ) -> Error {
293
306
Error :: new_user ( User :: UnsupportedStatusCode )
294
307
}
@@ -309,6 +322,7 @@ impl Error {
309
322
}
310
323
311
324
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
325
+ #[ cfg( feature = "server" ) ]
312
326
pub ( crate ) fn new_user_make_service < E : Into < Cause > > ( cause : E ) -> Error {
313
327
Error :: new_user ( User :: MakeService ) . with ( cause)
314
328
}
@@ -354,8 +368,10 @@ impl Error {
354
368
Kind :: Connect => "error trying to connect" ,
355
369
Kind :: Canceled => "operation was canceled" ,
356
370
#[ cfg( all( any( feature = "http1" , feature = "http2" ) , feature = "tcp" ) ) ]
371
+ #[ cfg( feature = "server" ) ]
357
372
Kind :: Listen => "error creating server listener" ,
358
373
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
374
+ #[ cfg( feature = "server" ) ]
359
375
Kind :: Accept => "error accepting connection" ,
360
376
#[ cfg( any( feature = "http1" , feature = "http2" , feature = "stream" ) ) ]
361
377
Kind :: Body => "error reading a body from connection" ,
@@ -372,10 +388,12 @@ impl Error {
372
388
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
373
389
Kind :: User ( User :: Body ) => "error from user's HttpBody stream" ,
374
390
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
391
+ #[ cfg( feature = "server" ) ]
375
392
Kind :: User ( User :: MakeService ) => "error from user's MakeService" ,
376
393
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
377
394
Kind :: User ( User :: Service ) => "error from user's Service" ,
378
395
#[ cfg( feature = "http1" ) ]
396
+ #[ cfg( feature = "server" ) ]
379
397
Kind :: User ( User :: UnexpectedHeader ) => "user sent unexpected header" ,
380
398
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
381
399
#[ cfg( feature = "client" ) ]
@@ -384,6 +402,7 @@ impl Error {
384
402
#[ cfg( feature = "client" ) ]
385
403
Kind :: User ( User :: UnsupportedRequestMethod ) => "request has unsupported HTTP method" ,
386
404
#[ cfg( feature = "http1" ) ]
405
+ #[ cfg( feature = "server" ) ]
387
406
Kind :: User ( User :: UnsupportedStatusCode ) => {
388
407
"response has 1xx status code, not supported by server"
389
408
}
0 commit comments