HTTPConnector

Mundry, Marvin Marvin.Mundry at uni-hamburg.de
Mon Oct 22 11:04:01 EDT 2018


> It could be that the attempt to get the content
> length is not functioning correctly [...] I have
> no experimental result that indicates that attempt
> is causing it to consume the body to get the length.
I can run getContentLength twice without getting an "Attempted read from closed stream".
Unless getContentLength caches it's result it is not reading from the stream.


var HashSet = Java.type("java.util.HashSet");
var HttpClientSupport = Java.type("net.shibboleth.utilities.java.support.httpclient.HttpClientSupport");
var IdPAttribute = Java.type("net.shibboleth.idp.attribute.IdPAttribute");
var StringAttributeValue = Java.type("net.shibboleth.idp.attribute.StringAttributeValue");

var attr = new IdPAttribute("groupXYZ");
var values = new HashSet();
values.add(new StringAttributeValue( response.getEntity().getContentLength() ));
values.add(new StringAttributeValue( response.getEntity().getContentLength() ));
attr.setValues(values);
connectorResults.add(attr);



--

Best regards,

Marvin


> -----Original Message-----
> From: users <users-bounces at shibboleth.net> On Behalf Of Cantor, Scott
> Sent: Montag, 22. Oktober 2018 16:49
> To: Shib Users <users at shibboleth.net>
> Subject: RE: HTTPConnector
> 
> > from what I understand
> > "Attempted read from closed stream"
> > means that something that is not my script is reading from the stream in
> > response.getEntity() (either before or after the execution of the
> script) which is
> > not possible as the stream can be read only once.
> 
> Yes, I would assume so. It could be that the attempt to get the content
> length is not functioning correctly, but I've tested it in the absence of
> the header being present, so I have no experimental result that indicates
> that attempt is causing it to consume the body to get the length.
> 
> -- Scott
> 
> --
> For Consortium Member technical support, see
> https://wiki.shibboleth.net/confluence/x/coFAAg
> To unsubscribe from this list send an email to users-
> unsubscribe at shibboleth.net


More information about the users mailing list