This will allow sitemaps generated by hosts with multiple names
to be referenced correctly.
void Header_HandleHost(StrBuf *Line, ParsedHttpHdrs *hdr)
{
void Header_HandleHost(StrBuf *Line, ParsedHttpHdrs *hdr)
{
- if (site_prefix == NULL) {
- site_prefix = NewStrBuf();
- StrBufAppendPrintf(site_prefix, "%s://", (is_https ? "https" : "http") );
- StrBufAppendBuf(site_prefix, Line, 0);
+ if (hdr->HostHeader != NULL) {
+ FreeStrBuf(&hdr->HostHeader);
+ hdr->HostHeader = NewStrBuf();
+ StrBufAppendPrintf(hdr->HostHeader, "%s://", (is_https ? "https" : "http") );
+ StrBufAppendBuf(hdr->HostHeader, Line, 0);
}
void Header_HandleXFFHost(StrBuf *Line, ParsedHttpHdrs *hdr)
{
}
void Header_HandleXFFHost(StrBuf *Line, ParsedHttpHdrs *hdr)
{
- if ( (follow_xff) && (site_prefix == NULL)) {
- site_prefix = NewStrBuf();
- StrBufAppendPrintf(site_prefix, "http://"); /* this is naive; do something about it */
- StrBufAppendBuf(site_prefix, Line, 0);
+ if (!follow_xff) return;
+
+ if (hdr->HostHeader != NULL) {
+ FreeStrBuf(&hdr->HostHeader);
+
+ hdr->HostHeader = NewStrBuf();
+ StrBufAppendPrintf(hdr->HostHeader, "http://"); /* this is naive; do something about it */
+ StrBufAppendBuf(hdr->HostHeader, Line, 0);
(ParsedHttpHdrs *httpreq)
{
FlushStrBuf(httpreq->PlainArgs);
(ParsedHttpHdrs *httpreq)
{
FlushStrBuf(httpreq->PlainArgs);
+ FlushStrBuf(httpreq->HostHeader);
FlushStrBuf(httpreq->this_page);
FlushStrBuf(httpreq->PlainArgs);
DeleteHash(&httpreq->HTTPHeaders);
FlushStrBuf(httpreq->this_page);
FlushStrBuf(httpreq->PlainArgs);
DeleteHash(&httpreq->HTTPHeaders);
FreeStrBuf(&httpreq->PlainArgs);
FreeStrBuf(&httpreq->this_page);
FreeStrBuf(&httpreq->PlainArgs);
FreeStrBuf(&httpreq->PlainArgs);
FreeStrBuf(&httpreq->this_page);
FreeStrBuf(&httpreq->PlainArgs);
+ FreeStrBuf(&httpreq->HostHeader);
DeleteHash(&httpreq->HTTPHeaders);
}
DeleteHash(&httpreq->HTTPHeaders);
}
StrBuf *c_language;
StrBuf *this_page; /* URL of current page */
StrBuf *PlainArgs;
StrBuf *c_language;
StrBuf *this_page; /* URL of current page */
StrBuf *PlainArgs;
HashList *urlstrings; /* variables passed to webcit in a URL */
HashList *HTTPHeaders; /* the headers the client sent us */
HashList *urlstrings; /* variables passed to webcit in a URL */
HashList *HTTPHeaders; /* the headers the client sent us */
#define num_parms(source) num_tokens(source, '|')
#endif
#define num_parms(source) num_tokens(source, '|')
#endif
+#define site_prefix (WC ? (WC->Hdr->HostHeader) : NULL)
+
/* Per-session data */
#define WC ((struct wcsession *)pthread_getspecific(MyConKey))
extern pthread_key_t MyConKey;
/* Per-session data */
#define WC ((struct wcsession *)pthread_getspecific(MyConKey))
extern pthread_key_t MyConKey;
extern int follow_xff;
extern int num_threads_existing;
extern int num_threads_executing;
extern int follow_xff;
extern int num_threads_existing;
extern int num_threads_executing;
-extern StrBuf *site_prefix;
void InitialiseSemaphores(void);
void begin_critical_section(int which_one);
void InitialiseSemaphores(void);
void begin_critical_section(int which_one);
int follow_xff = 0; /* Follow X-Forwarded-For: header */
int home_specified = 0; /* did the user specify a homedir? */
int DisableGzip = 0;
int follow_xff = 0; /* Follow X-Forwarded-For: header */
int home_specified = 0; /* did the user specify a homedir? */
int DisableGzip = 0;
-StrBuf *site_prefix = NULL;
extern pthread_mutex_t SessionListMutex;
extern pthread_key_t MyConKey;
extern pthread_mutex_t SessionListMutex;
extern pthread_key_t MyConKey;