You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Andrew Patterson (Jira)" <xe...@xml.apache.org> on 2021/10/20 16:51:00 UTC

[jira] [Comment Edited] (XERCESC-2220) Winsock Network Accessor does not support https URLs

    [ https://issues.apache.org/jira/browse/XERCESC-2220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17431361#comment-17431361 ] 

Andrew Patterson edited comment on XERCESC-2220 at 10/20/21, 4:50 PM:
----------------------------------------------------------------------

We ran into this problem years ago and came to the same conclusion. It's positively baffling that this hasn't been remedied.

Our solution was basically to use libcurl. There's literally nothing in the code that prevents this – it's purely prevented via cmake. We generated a Windows project and then removed WinSockNetAccessor.cpp and BinHTTPURLInputStream.cpp from the project and added CurlURLInputStream.cpp &CurlNetAccessor.cpp. We also had to remove XERCES_USE_NETACCESSOR_WINSOCK define & added CURL_STATICLIB & XERCES_USE_NETACCESSOR_CURL to the define list. You obviously also need to add the paths to the includes & .lib for curl.

 

Note that we did this for 3.1.4 and haven't updated for a while – but I imagine the process is very similar.

 

Ideally, you should be able to just specify curl for your net accessor when building on Windows because, well, it works just fine. Or they could implement Winsock HTTPS support. Frankly, the former would be easier, but both should be options. I'd do it myself but I don't know understand how to satisfy 'find_package(curl)' in cmake.


was (Author: andrew@avenza.com):
We ran into this problem years ago and came to the same conclusion. It's positively baffling that this hasn't been remedied.

Our solution was basically to use libcurl. There's literally nothing in the code that prevents this – it's purely prevented via cmake. We generated a Windows project and then removed WinSockNetAccessor.cpp and BinHTTPURLInputStream.cpp from the project and added CurlURLInputStream.cpp &CurlNetAccessor.cpp. We also had to remove XERCES_USE_NETACCESSOR_WINSOCK define & added CURL_STATICLIB & XERCES_USE_NETACCESSOR_CURL to the define list. You obviously also need to add the paths to the includes & .lib for curl.

 

Note that we did this for 3.1.4 and haven't updated for a while – but I imagine the process is very similar.

 

Ideally, you should be able to just specify curl for your net accessor when building on Windows because, well, it works just fine. Or they could implemented Winsock HTTPS support. Frankly, the former would be easier, but both should be options. I'd do it myself but I don't know understand how to satisfy 'find_package(curl)' in cmake.

> Winsock Network Accessor does not support https URLs
> ----------------------------------------------------
>
>                 Key: XERCESC-2220
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2220
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 3.2.3
>         Environment: Windows 10
> MinGW 7.3.0 64-bit
>            Reporter: Florian Meinicke
>            Priority: Major
>
> According to [a comment|https://issues.apache.org/jira/browse/XERCESC-2029?focusedCommentId=13982847&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13982847] from [Xerces-C++/XERCESC-2029|https://issues.apache.org/jira/browse/XERCESC-2029] only the curl and winsock network accessors support https URLs.
> While I got everything working on Linux using the curl accessor I cannot do so on Windows. I'm still getting the "unsupported protocol in URL" error even though I'm using the winsock accessor.  
> The problem appears to be that https has been deliberately disabled for the winsock accessor:
> Taken from {{src/xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.cpp}}:
> {code:cpp}
> BinInputStream* WinSockNetAccessor::makeNew(const XMLURL&  urlSource, const XMLNetHTTPInfo* httpInfo /*=0*/)
> {
>     XMLURL::Protocols  protocol = urlSource.getProtocol();
>     switch(protocol)
>     {
>         case XMLURL::HTTP:
>         {
>             BinHTTPURLInputStream* retStrm =
>                 new (urlSource.getMemoryManager()) BinHTTPURLInputStream(urlSource, httpInfo);
>             return retStrm;
>             break;
>         }
>         //
>         // These are the only protocols we support now. So throw and
>         // unsupported protocol exception for the others.
>         //
>         default :
>             ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_UnsupportedProto, urlSource.getMemoryManager());
>             break;
>     }
>     return 0;
> }
> {code}
> My understanding is that the winsock accessor should support https URLs so the question is why is https being disabled in {{WinSockNetAccessor}}?
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org