+
+static size_t GetLocationString( void *ptr, size_t size, size_t nmemb, void *userdata)
+{
+#define LOCATION "location"
+ if (strncasecmp((char*)ptr, LOCATION, sizeof(LOCATION) - 1) == 0)
+ {
+ AsyncIO *IO = (AsyncIO *) userdata;
+ rss_aggregator *RSSAggr = (rss_aggregator *)IO->Data;
+
+ char *pch = (char*) ptr;
+ char *pche;
+
+ pche = pch + (size * nmemb);
+ pch += sizeof(LOCATION);
+
+ while (isspace(*pch) || (*pch == ':'))
+ pch ++;
+
+ while (isspace(*pche) || (*pche == '\0'))
+ pche--;
+ if (RSSAggr->RedirectUrl == NULL) {
+ RSSAggr->RedirectUrl = NewStrBufPlain(pch, pche - pch + 1);
+ }
+ else {
+ FlushStrBuf(RSSAggr->RedirectUrl);
+ StrBufPlain(RSSAggr->RedirectUrl, pch, pche - pch + 1);
+ }
+ }
+ return size * nmemb;
+}
+