Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add last-modified http header. #1

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.apache.commons.compress.compressors.brotli.BrotliCompressorInputStrea
import org.apache.commons.httpclient.ChunkedInputStream
import org.apache.commons.io.input.BoundedInputStream
import org.archive.webservices.sparkling.io.IOUtil
import org.archive.webservices.sparkling.util.StringUtil
import org.archive.webservices.sparkling.util.{RegexUtil, StringUtil}

import scala.util.Try

Expand All @@ -23,6 +23,7 @@ class HttpMessage(val statusLine: String, val headers: Seq[(String, String)], va
headerMap.get("content-type").flatMap(_.split(';').drop(1).headOption).map(_.trim).filter(_.startsWith("charset="))
.map(_.drop(8).trim.stripPrefix("\"").stripPrefix("'").stripSuffix("'").stripSuffix("\"").split(",", 2).head.trim).filter(_.nonEmpty).map(_.toUpperCase)
}
def lastModified: Option[String] = headerMap.get("last-modified").map(_.trim)
def redirectLocation: Option[String] = headerMap.get("location").map(_.trim)
def isChunked: Boolean = headerMap.get("transfer-encoding").map(_.toLowerCase).contains("chunked")

Expand Down