Skip to content

Commit

Permalink
Now returns correct record.
Browse files Browse the repository at this point in the history
  • Loading branch information
csrster committed Aug 25, 2020
1 parent 65fd5e0 commit 671d7f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -165,8 +165,8 @@ public BitarchiveRecord getWarc( URI uri, long offset) throws IOException, URISy
HttpUriRequest request = RequestBuilder.get()
.setUri(uri)
.addHeader("User-Agent",USER_AGENT)
.setHeader(HttpHeaders.CONTENT_TYPE, "application/warc") // STREAM_ALL = -1;
.setHeader("Range", "bytes=" + offset + "-") // offset + 1?? might require <= -1 check and > 1 check
//.setHeader(HttpHeaders.CONTENT_TYPE, "application/warc") // STREAM_ALL = -1;
.addHeader("Range", "bytes=" + offset + "-") // offset + 1?? might require <= -1 check and > 1 check
.build();

System.out.println("Executing request " + request.getRequestLine());
Expand Down Expand Up @@ -290,7 +290,7 @@ public BitarchiveRecord get(String arcfileName, long index) throws ArgumentNotVa
//BitarchiveRecord warcInstance = this.getWarc(this.getBaseUri(), this.getOffset());
String strUri = this.getBaseUri().toString() + "/" + arcfileName;
URI uri = new URI(strUri);
BitarchiveRecord warcInstance = this.getWarc(uri, this.getOffset());
BitarchiveRecord warcInstance = this.getWarc(uri, index);
return warcInstance;
}

Expand Down
Expand Up @@ -71,6 +71,7 @@ public void get() throws IOException, URISyntaxException {
BitarchiveRecord bitarchiveRecord = warcRecordClient.get("10-4-20161218234343407-00000-kb-test-har-003.kb.dk.warc.gz", 3442L);
assertNotNull("Should have non null BitarchiveRecord", bitarchiveRecord);
assertTrue("Expect a non-zero length bitarchiveRecord", IOUtils.toByteArray(bitarchiveRecord.getData()).length > 100);
System.out.println("\n\n" + IOUtils.toString(bitarchiveRecord.getData()));
}

@Test
Expand Down

0 comments on commit 671d7f6

Please sign in to comment.