コード例 #1
0
ファイル: ne_xmlreq.c プロジェクト: Ugnis/Far-NetBox
int ne_xml_dispatch_request(ne_request *req, ne_xml_parser *parser)
{
    int ret;

    do {
        int parseit = 0;

        ret = ne_begin_request(req);
        if (ret) break;
        
        if (ne_get_status(req)->klass == 2) {
            ne_content_type ctype;
            
            if (ne_get_content_type(req, &ctype) == 0) {
                parseit = media_type_is_xml(&ctype);
                ne_free(ctype.value);
            }
        }

        if (parseit)
            ret = ne_xml_parse_response(req, parser);
        else
            ret = ne_discard_response(req);
        
        if (ret == NE_OK)
            ret = ne_end_request(req);
    } while (ret == NE_RETRY);

    return ret;
}
コード例 #2
0
ファイル: util.c プロジェクト: DJEX93/dsploit
/* Custom function of type ne_accept_response. */
static int ra_neon_error_accepter(void *userdata,
                                  ne_request *req,
                                  const ne_status *st)
{
  /* Before, this function was being run for *all* responses including
     the 401 auth challenge.  In neon 0.24.x that was harmless.  But
     in neon 0.25.0, trying to parse a 401 response as XML using
     ne_xml_parse_v aborts the response; so the auth hooks never got a
     chance. */
  ne_content_type ctype;

  /* Only accept non-2xx responses with text/xml content-type */
  if (st->klass != 2 && ne_get_content_type(req, &ctype) == 0)
    {
      int is_xml =
        (strcmp(ctype.type, "text") == 0 && strcmp(ctype.subtype, "xml") == 0);
      ne_free(ctype.value);
      return is_xml;
    }
  else
    return 0;
}