web_set_user working for port 80 http url but same code not working for port 443 https url

Trying to write script for windows SSO and i am using web_set_user for it. The credentials are getting entered if the url is http and validation is working fine but same url with https, the credentials are not getting entered and getting 401 as http return code. 

Any suggestions would be helpful.