4 Commits
Author SHA1 Message Date
jaytux 1d10802140 CLI: formatting 2026-08-27 15:23:07 +02:00
jaytux 62f952ac68 CORS headers for SSE 2026-08-27 14:29:27 +02:00
jaytux c662626bd8 Server version bump 2026-08-27 14:11:19 +02:00
jaytux e40afb2c3d Server: CORS support on SSE routes 2026-08-27 14:10:04 +02:00
4 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ plugins {
}
group = "com.jaytux.phoebench"
version = rootProject.version as PhoebenchVersion
version = PhoebenchVersion(1, 1, 1)
if((version as PhoebenchVersion) < (rootProject.version as PhoebenchVersion))
throw GradleException("CLI Client version must be at least as high as protocol/common version")
@@ -78,7 +78,7 @@ object ProjectHandlers {
println("\n${it.benchmarks.size} benchmarks:")
it.benchmarks.forEach { b ->
println(" - [${b.id}] ${b.name} with ${b.entries.size} entries:")
println(" - [${b.id}] BENCHMARK ${b.name} (with ${b.entries.size} entries):")
b.entries.forEach { e ->
println(" - [${e.id}] ENTRY versioned ${map[e.versionId]?.name ?: "<invalid version>"} at ${e.timestamp.fmt()} " +
"(${e.warmups.size} warmup data points, ${e.measurements.size} measurement data points; in ${e.unit.disp})")
+1 -1
View File
@@ -7,7 +7,7 @@ plugins {
}
group = "com.jaytux.phoebench"
version = PhoebenchVersion(1, 1, 1)
version = PhoebenchVersion(1, 1, 2)
if((version as PhoebenchVersion) < (rootProject.version as PhoebenchVersion))
throw GradleException("Server version must be at least as high as protocol/common version")
@@ -37,20 +37,23 @@ fun Application.module() {
json()
}
install(SSE) {}
val allowLocalhost = environment.config.propertyOrNull("ktor.cors.enableLocalhostOn")?.getString() ?: "0"
val safeOrigin = environment.config.propertyOrNull("ktor.cors.browserOrigin")?.getString()
install(CORS) {
// -- methods --
allowMethod(HttpMethod.Options)
allowMethod(HttpMethod.Delete)
allowMethod(HttpMethod.Patch)
allowMethod(HttpMethod.Get)
allowMethod(HttpMethod.Post)
// -- headers --
allowHeader(HttpHeaders.Accept)
allowHeader(HttpHeaders.Pragma)
allowHeader(HttpHeaders.Authorization)
allowHeader(HttpHeaders.ContentType)
allowHeader(HttpHeaders.CacheControl)
allowHeader(HttpHeaders.LastEventID)
// -- exposed headers --
exposeHeader(HttpHeaders.ContentType)
allowCredentials = true
allowNonSimpleContentTypes = true
@@ -73,6 +76,8 @@ fun Application.module() {
}
}
install(SSE) {}
install(StatusPages) {
status(HttpStatusCode.Forbidden) { call, status ->
call.respond(status, ErrorResponse("Access Forbidden: CORS failed."))