Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update lexer to handle relative urls returned with HTTP 302 which some

servers seem ot do.
  • Loading branch information...
commit a7fc7cea6dd928efce43e9a63340c61f619a07f0 1 parent 6c449e7
@subbuss authored
View
9 lexer/src/main/java/org/htmlparser/http/ConnectionManager.java
@@ -635,7 +635,14 @@ public URLConnection openConnection (URLConnection connection)
if ((3 == (code / 100)) && (repeated < 20))
if (null != (uri = getLocation (http)))
{
- url = new URL (uri);
+ if (uri.startsWith("http://") || uri.startsWith("https://")) {
+ url = new URL(uri);
+ }
+ else {
+ String oldUrl = url.toString();
+ String domain = oldUrl.substring(0, oldUrl.indexOf("/", 8)+1);
+ url = new URL(domain + uri);
+ }
connection = url.openConnection ();
repeat = true;
repeated++;

1 comment on commit a7fc7ce

@shauvik

Cool, thanks for pushing.

Please sign in to comment.
Something went wrong with that request. Please try again.