[JIRA] (JSSH-25) HTTPResource needs some rework to properly close response

Rod Widdowson (Jira) jira at shibboleth.atlassian.net
Mon Apr 3 15:31:55 UTC 2023


Rod Widdowson ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=59fb32bbc24efb3c4ed3c977 ) *commented* on JSSH-25 ( https://shibboleth.atlassian.net/browse/JSSH-25?atlOrigin=eyJpIjoiMTI5MGE4NWQ0ZGE1NDc1YWEwN2JmZmUyYTA2ZWQ2MTAiLCJwIjoiaiJ9 )

Re: HTTPResource needs some rework to properly close response ( https://shibboleth.atlassian.net/browse/JSSH-25?atlOrigin=eyJpIjoiMTI5MGE4NWQ0ZGE1NDc1YWEwN2JmZmUyYTA2ZWQ2MTAiLCJwIjoiaiJ9 )

it looks to me as though HttpResource is safe

* As noted the input stream is protected via the encapsulated ConnectionClosingInputStream
* All header inspection goes via getResponseHeader which in turn calls getResourceHeaders
* This last takes a ClassicHttpResponse , closes it and returns it as an HttpResponse
* So in all cases the returned ClasscHttpResponse *is* closed
* the other function is exists and this also calls getResourceHeaders

The header handling is weird and Brent Putman ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A97de0981-adc3-4044-95ed-131622fad81e ) (I think) comments:

    * TODO: I suspect this needs to be revised to not return the HttpResponse since it's been closed.

But pragmatically the only public methods which call this are exists() , lastModified() and contentLength() and these are all tested.

Looking at the code of the current implementation it does look as though these things are just returning cached state and so can work on a closed response.

I’ll leave this open since we might want to recast those three methods vai a different route through the code (i.e. do all the work via a getReosurceHeadersCloseable() and then close the connection) but it seems like a lot of work for something which works right now.

( https://shibboleth.atlassian.net/browse/JSSH-25#add-comment?atlOrigin=eyJpIjoiMTI5MGE4NWQ0ZGE1NDc1YWEwN2JmZmUyYTA2ZWQ2MTAiLCJwIjoiaiJ9 ) Add Comment ( https://shibboleth.atlassian.net/browse/JSSH-25#add-comment?atlOrigin=eyJpIjoiMTI5MGE4NWQ0ZGE1NDc1YWEwN2JmZmUyYTA2ZWQ2MTAiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100221- sha1:d541bce )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/commits/attachments/20230403/675e3139/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-comment-icon-eaaaf79e-7c40-4142-9edf-c9c9df89fb27
Type: image/png
Size: 1084 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20230403/675e3139/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-footer-desktop-logo-33f39733-efe1-457a-bb24-0fadf4d925ce
Type: image/png
Size: 10805 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20230403/675e3139/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-avatar-56c1be1b-1520-4444-8683-4d1862d393d9
Type: image/png
Size: 484 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20230403/675e3139/attachment-0005.png>


More information about the commits mailing list