[wp-trac] [WordPress Trac] #17010: Inconsistent handling of HTTP response codes

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 1 00:00:14 UTC 2011


#17010: Inconsistent handling of HTTP response codes
--------------------------+-----------------------------
 Reporter:  sivel         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  HTTP          |    Version:  3.1
 Severity:  normal        |   Keywords:  dev-feedback
--------------------------+-----------------------------
 I noticed during some testing to see what would happen if a server
 returned a 404 when streaming to a file,and found some inconsistent
 handling of response codes between transports.

 The below test checks to see if the transport returns a WP_Error or if it
 returns an actual response. If the second column is an integer matching
 the first column then the transport returned a response, if the second
 column is 'wp_error' then the transport returned WP_Error for that
 response code.

 STREAMS:
 {{{
 100 => 100
 101 => 101
 102 => 102
 200 => 200
 201 => 201
 202 => 202
 203 => 203
 204 => 204
 205 => 205
 206 => 206
 207 => 207
 226 => 226
 300 => 300
 301 => 301
 302 => 302
 303 => 303
 304 => 304
 305 => 305
 306 => 306
 307 => 307
 400 => 400
 401 => 401
 402 => 402
 403 => 403
 404 => 404
 405 => 405
 406 => 406
 407 => 407
 408 => 408
 409 => 409
 410 => 410
 411 => 411
 412 => 412
 413 => 413
 414 => 414
 415 => 415
 416 => 416
 417 => 417
 422 => 422
 423 => 423
 424 => 424
 426 => 426
 500 => 500
 501 => 501
 502 => 502
 503 => 503
 504 => 504
 505 => 505
 506 => 506
 507 => 507
 510 => 510
 }}}

 FSOCKOPEN:
 {{{
 100 => 100
 101 => 101
 102 => 102
 200 => 200
 201 => 201
 202 => 202
 203 => 203
 204 => 204
 205 => 205
 206 => 206
 207 => 207
 226 => 226
 300 => 300
 301 => 301
 302 => 302
 303 => 303
 304 => 304
 305 => 305
 306 => 306
 307 => 307
 400 => wp_error
 401 => wp_error
 402 => wp_error
 403 => wp_error
 404 => wp_error
 405 => wp_error
 406 => wp_error
 407 => wp_error
 408 => wp_error
 409 => wp_error
 410 => wp_error
 411 => wp_error
 412 => wp_error
 413 => wp_error
 414 => wp_error
 415 => wp_error
 416 => wp_error
 417 => wp_error
 422 => wp_error
 423 => wp_error
 424 => wp_error
 426 => wp_error
 500 => 500
 501 => 501
 502 => 502
 503 => 503
 504 => 504
 505 => 505
 506 => 506
 507 => 507
 510 => 510
 }}}

 EXTHTTP:
 {{{
 100 => wp_error
 101 => wp_error
 102 => wp_error
 200 => 200
 201 => 201
 202 => 202
 203 => 203
 204 => 204
 205 => 205
 206 => 206
 207 => 207
 226 => 226
 300 => 300
 301 => 301
 302 => 302
 303 => 303
 304 => 304
 305 => 305
 306 => 306
 307 => 307
 400 => 400
 401 => 401
 402 => 402
 403 => 403
 404 => 404
 405 => 405
 406 => 406
 407 => 407
 408 => 408
 409 => 409
 410 => 410
 411 => 411
 412 => 412
 413 => 413
 414 => 414
 415 => 415
 416 => 416
 417 => 417
 422 => 422
 423 => 423
 424 => 424
 426 => 426
 500 => 500
 501 => 501
 502 => 502
 503 => 503
 504 => 504
 505 => 505
 506 => 506
 507 => 507
 510 => 510
 }}}

 CURL:
 {{{
 100 => wp_error
 101 => wp_error
 102 => wp_error
 200 => 200
 201 => 201
 202 => 202
 203 => 203
 204 => 204
 205 => 205
 206 => 206
 207 => 207
 226 => 226
 300 => 300
 301 => 301
 302 => 302
 303 => 303
 304 => 304
 305 => 305
 306 => 306
 307 => 307
 400 => 400
 401 => 401
 402 => 402
 403 => 403
 404 => 404
 405 => 405
 406 => 406
 407 => 407
 408 => 408
 409 => 409
 410 => 410
 411 => 411
 412 => 412
 413 => 413
 414 => 414
 415 => 415
 416 => 416
 417 => 417
 422 => 422
 423 => 423
 424 => 424
 426 => 426
 500 => 500
 501 => 501
 502 => 502
 503 => 503
 504 => 504
 505 => 505
 506 => 506
 507 => 507
 510 => 510
 }}}

 We need to define when we want to return a WP_Error, if ever.  I am
 thinking that returning a WP_Error is not very useful if we get a response
 from the server.  The response codes tested were obtained from
 get_status_header_desc().

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17010>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list