softlayer / softlayer-object-storage-php

SoftLayer Object Storage PHP Client
Other
28 stars 18 forks source link

Don't automatically reauthenticate on 404 errors #20

Closed etaoins closed 9 years ago

etaoins commented 9 years ago

GET, HEAD, and DELETE were capturing any exception from the lower level operation and automatically reauthenticating before retrying. The intent is to catch expired authentication and transparently retry the operation.

This is inefficient for querying files that don't exist on object storage as it will trigger the following flow:

1) GET/HEAD/DELETE is attempted on a non-existent object 2) The original request fails with an Http_NotFound exception 3) Reauthentication is performed against Object Storage 4) The original request is attempted again and the Http_NotFound exception is allow to propagate to the caller

Handle this case by explicitly catching an Http_NotFound exception and rethrowing it at step #2 above

petrkotek commented 9 years ago

:+1: (maybe adding tests around this would be nice though)

ping @briancline

briancline commented 9 years ago

Thanks for the reminder. Yeah, tests would be good for this. I'll go ahead and merge for now. Thank you for the patch!

petrkotek commented 9 years ago

thanks for taking care of the pull requests! :tada:

briancline commented 9 years ago

Sure thing!