[gdal-dev] WFS driver - HTTP 401 authentication error message

Odd Ragnar Lydersen Odd-Ragnar.Lydersen at powel.no
Thu Sep 15 04:20:57 PDT 2016


Hello, I'm experiencing some warnings in GDAL 2.1 and error messages (HTTP 401) from the server.

In I'm getting some unwanted results.
However I am able to read features from the server, but I wonder why these errors occur, and if I'm not getting all the information I should have gotten if this error did not occur.

I have stepped into CPLXMLNode *CPLParseXMLString( const char *pszString )
Before the HTTP error, *pszString,  is this:

<gml_registry>
    <!-- Finnish National Land Survey cadastral data -->
    <namespace prefix="ktjkiiwfs" uri="http://xml.nls.fi/ktjkiiwfs/2010/02" useGlobalSRSName="true">
        <featureType elementName="KiinteistorajanSijaintitiedot"
                 schemaLocation="http://xml.nls.fi/XML/Schema/sovellus/ktjkii/modules/kiinteistotietojen_kyselypalvelu_WFS/Asiakasdokumentaatio/ktjkiiwfs/2010/02/KiinteistorajanSijaintitiedot.xsd"/>
        <featureType elementName="PalstanTunnuspisteenSijaintitiedot"
                 schemaLocation="http://xml.nls.fi/XML/Schema/sovellus/ktjkii/modules/kiinteistotietojen_kyselypalvelu_WFS/Asiakasdokumentaatio/ktjkiiwfs/2010/02/palstanTunnuspisteenSijaintitiedot.xsd"/>
        <featureType elementName="RekisteriyksikonTietoja"
                 schemaLocation="http://xml.nls.fi/XML/Schema/sovellus/ktjkii/modules/kiinteistotietojen_kyselypalvelu_WFS/Asiakasdokumentaatio/ktjkiiwfs/2010/02/RekisteriyksikonTietoja.xsd"/>
        <featureType elementName="PalstanTietoja"
                 schemaLocation="http://xml.nls.fi/XML/Schema/sovellus/ktjkii/modules/kiinteistotietojen_kyselypalvelu_WFS/Asiakasdokumentaatio/ktjkiiwfs/2010/02/PalstanTietoja.xsd"/>
    </namespace>

...

</gml_registry>

And the next call to the same function I get the error, and *pszString,  is this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 401--Unauthorized</TITLE>
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 401--Unauthorized</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
</FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.2 401 Unauthorized</H4>
</FONT><P><FONT FACE="Courier New">The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 11.</FONT></P>
</FONT></TD></TR>
</TABLE>

</BODY>
</HTML>

Could it be that the authentication parameter is not sendt in the response call to the server in between these two answers?
I can see that there is a call to CPLHTTPResult *CPLHTTPFetch( const char *pszURL, char **papszOptions ) , without any content in **papszOptions.
In other calls I can see that the UserPwd is sendt in the **papszOptions variable.

Odd-Ragnar Lydersen
System Developer

Email: odd-ragnar.lydersen at powel.no<mailto:odd-ragnar.lydersen at powel.no>
www.powel.no<http://www.powel.com/>
[cid:image002.jpg at 01CDD1F7.F470C190]<http://www.powel.no/en>[cid:image004.jpg at 01CDD1F7.F470C190]<https://www.facebook.com/pages/Powel/350917775700>[cid:image006.jpg at 01CDD1F7.F470C190]<http://www.linkedin.com/company/powel-as>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160915/ba42513e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1268 bytes
Desc: image001.jpg
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160915/ba42513e/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 870 bytes
Desc: image002.jpg
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160915/ba42513e/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 909 bytes
Desc: image003.jpg
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160915/ba42513e/attachment-0002.jpg>


More information about the gdal-dev mailing list