The R Project SVN R

Rev

Rev 42583 | Rev 52104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 42583 Rev 44133
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 2001-6   The R Development Core Team.
3
 *  Copyright (C) 2001-8   The R Development Core Team.
4
 *
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 2 of the License, or
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
8
 *  (at your option) any later version.
Line 121... Line 121...
121
#define xmlMalloc malloc
121
#define xmlMalloc malloc
122
#define xmlRealloc realloc
122
#define xmlRealloc realloc
123
#define xmlMemStrdup strdup
123
#define xmlMemStrdup strdup
124
#define xmlStrndup(a, b) strdup(a)
124
#define xmlStrndup(a, b) strdup(a)
125
#define xmlStrstr(a, b) strstr((const char *)a, (const char *)b) 
125
#define xmlStrstr(a, b) strstr((const char *)a, (const char *)b) 
126
#define xmlStrcat strcat
-
 
127
#define xmlStrdup(a) strdup((char *)a)
126
#define xmlStrdup(a) strdup((char *)a)
128
 
127
 
129
static void RxmlNanoHTTPScanProxy(const char *URL);
128
static void RxmlNanoHTTPScanProxy(const char *URL);
130
static void *RxmlNanoHTTPMethod(const char *URL, const char *method,
129
static void *RxmlNanoHTTPMethod(const char *URL, const char *method,
131
				const char *input, char **contentType,
130
				const char *input, char **contentType,
Line 870... Line 869...
870
        cur += 9;
869
        cur += 9;
871
	while ((*cur == ' ') || (*cur == '\t')) cur++;
870
	while ((*cur == ' ') || (*cur == '\t')) cur++;
872
	if (ctxt->location != NULL)
871
	if (ctxt->location != NULL)
873
	    xmlFree(ctxt->location);
872
	    xmlFree(ctxt->location);
874
	if (*cur == '/') {
873
	if (*cur == '/') {
875
	    char *tmp_http = xmlStrdup(BAD_CAST "http://");
-
 
876
	    char *tmp_loc = 
874
	    char buf[1000];
877
	        xmlStrcat(tmp_http, (const char *) ctxt->hostname);
875
	    snprintf(buf, 1000, "http://%s%s", ctxt->hostname, cur);
878
	    ctxt->location = 
876
	    ctxt->location = xmlMemStrdup(buf);
879
	        (char *) xmlStrcat (tmp_loc, (const char *) cur);
-
 
880
	} else {
877
	} else {
881
	    ctxt->location = xmlMemStrdup(cur);
878
	    ctxt->location = xmlMemStrdup(cur);
882
	}
879
	}
883
    } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"WWW-Authenticate:", 17)) {
880
    } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"WWW-Authenticate:", 17)) {
884
        cur += 17;
881
        cur += 17;
Line 1437... Line 1434...
1437
	RxmlMessage(1, _("redirect to: '%s'"), ctxt->location);
1434
	RxmlMessage(1, _("redirect to: '%s'"), ctxt->location);
1438
	while (RxmlNanoHTTPRecv(ctxt)) ;
1435
	while (RxmlNanoHTTPRecv(ctxt)) ;
1439
        if (nbRedirects < XML_NANO_HTTP_MAX_REDIR) {
1436
        if (nbRedirects < XML_NANO_HTTP_MAX_REDIR) {
1440
	    nbRedirects++;
1437
	    nbRedirects++;
1441
	    redirURL = xmlMemStrdup(ctxt->location);
1438
	    redirURL = xmlMemStrdup(ctxt->location);
-
 
1439
	    fflush(stdout);
1442
	    RxmlNanoHTTPFreeCtxt(ctxt);
1440
	    RxmlNanoHTTPFreeCtxt(ctxt);
1443
	    goto retry;
1441
	    goto retry;
1444
	}
1442
	}
1445
	RxmlNanoHTTPFreeCtxt(ctxt);
1443
	RxmlNanoHTTPFreeCtxt(ctxt);
1446
	RxmlMessage(2, _("too many redirects, aborting ..."));
1444
	RxmlMessage(2, _("too many redirects, aborting ..."));