Skip to content

Commit b7b38c8

Browse files
committed
brute force proxy
1 parent 39fef94 commit b7b38c8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

samples/scripts/textclass-proxy.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ async function processDLXS(req, res) {
145145
res.cookie('DLXSsid', cookieValue, { path: '/' });
146146
console.log("AHOY AHOY cookie = ", cookieValue);
147147
}
148-
const xmlData = (await resp.text()).replace(/https:\/\/localhost/g, 'http://localhost');
148+
let xmlData = (await resp.text()).replace(/https:\/\/localhost/g, 'http://localhost');
149149
if ( xmlData.indexOf('no hits. normally cgi redirects') > -1 ) {
150150
throw new Error('Query has no results');
151151
}
@@ -167,6 +167,8 @@ async function processDLXS(req, res) {
167167
return;
168168
}
169169

170+
xmlData = xmlData.replaceAll('roger.quod.lib.umich.edu', req.headers['x-forwarded-host'] || 'localhost:5555');
171+
170172
if ( url.searchParams.get('debug') == 'xml' ) {
171173
res.setHeader("Content-Type", "application/xml");
172174
res.send(xmlData);
@@ -372,6 +374,7 @@ function listen(options) {
372374
res.redirect(redirectUrl);
373375
return;
374376
}
377+
console.log("--?", req.originalUrl);
375378
if (isbot(req.get('user-agent'))) {
376379
res.send("Beep boop");
377380
return;

0 commit comments

Comments
 (0)