Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Guix Cuirass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Panda
Guix Cuirass
Commits
c88a7c00
Unverified
Commit
c88a7c00
authored
5 years ago
by
Ricardo Wurmus
Browse files
Options
Downloads
Patches
Plain Diff
http: Be explicit about accepted HTTP methods.
* src/cuirass/http.scm (url-handler): Match on HTTP method.
parent
80b6e89a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cuirass/http.scm
+15
-20
15 additions, 20 deletions
src/cuirass/http.scm
with
15 additions
and
20 deletions
src/cuirass/http.scm
+
15
−
20
View file @
c88a7c00
...
...
@@ -246,14 +246,12 @@ Hydra format."
(
log-message
"~a ~a"
(
request-method
request
)
(
uri-path
(
request-uri
request
)))
;; Reject OPTIONS, POST, etc.
(
match
(
if
(
eq?
'GET
(
request-method
request
))
(
request-path-components
request
)
'method-not-allowed
)
(((
or
"jobsets"
"specifications"
)
.
rest
)
(
match
(
cons
(
request-method
request
)
(
request-path-components
request
))
((
'GET
(
or
"jobsets"
"specifications"
)
.
rest
)
(
respond-json
(
object->json-string
(
list->vector
(
db-get-specifications
)))))
((
"build"
id
)
((
'GET
"build"
id
)
(
let
((
hydra-build
(
handle-build-request
(
if
(
string-suffix?
".drv"
id
)
(
string-append
(
%store-prefix
)
"/"
id
)
...
...
@@ -261,7 +259,7 @@ Hydra format."
(
if
hydra-build
(
respond-json
(
object->json-string
hydra-build
))
(
respond-build-not-found
id
))))
((
"build"
build-id
"details"
)
((
'GET
"build"
build-id
"details"
)
(
let
((
build
(
db-get-build
(
string->number
build-id
))))
(
if
build
(
respond-html
...
...
@@ -270,7 +268,7 @@ Hydra format."
`
(((
#
:name
.
,
(
assq-ref
build
#
:specification
))
(
#
:link
.
,
(
string-append
"/jobset/"
(
assq-ref
build
#
:specification
)))))))
(
respond-build-not-found
build-id
))))
((
"build"
build-id
"log"
"raw"
)
((
'GET
"build"
build-id
"log"
"raw"
)
(
let
((
build
(
db-get-build
(
string->number
build-id
))))
(
if
build
(
match
(
assq-ref
build
#
:outputs
)
...
...
@@ -291,7 +289,7 @@ Hydra format."
(
#f
(
respond-build-not-found
build-id
)))
(
respond-build-not-found
build-id
))))
((
"api"
"evaluations"
)
((
'GET
"api"
"evaluations"
)
(
let*
((
params
(
request-parameters
request
))
;; 'nr parameter is mandatory to limit query size.
(
nr
(
assq-ref
params
'nr
)))
...
...
@@ -301,7 +299,7 @@ Hydra format."
(
map
evaluation->json-object
(
db-get-evaluations
nr
)))))
(
respond-json-with-error
500
"Parameter not defined!"
))))
((
"api"
"latestbuilds"
)
((
'GET
"api"
"latestbuilds"
)
(
let*
((
params
(
request-parameters
request
))
;; 'nr parameter is mandatory to limit query size.
(
valid-params?
(
assq-ref
params
'nr
)))
...
...
@@ -313,7 +311,7 @@ Hydra format."
,@
params
(
order
.
finish-time
)))))
(
respond-json-with-error
500
"Parameter not defined!"
))))
((
"api"
"queue"
)
((
'GET
"api"
"queue"
)
(
let*
((
params
(
request-parameters
request
))
;; 'nr parameter is mandatory to limit query size.
(
valid-params?
(
assq-ref
params
'nr
)))
...
...
@@ -326,14 +324,14 @@ Hydra format."
,@
params
(
order
.
status+submission-time
)))))
(
respond-json-with-error
500
"Parameter not defined!"
))))
(
'
()
((
'GET
)
(
respond-html
(
html-page
"Cuirass"
(
specifications-table
(
db-get-specifications
))
'
())))
((
"jobset"
name
)
((
'GET
"jobset"
name
)
(
respond-html
(
let*
((
evaluation-id-max
(
db-get-evaluations-id-max
name
))
(
evaluation-id-min
(
db-get-evaluations-id-min
name
))
...
...
@@ -351,7 +349,7 @@ Hydra format."
`
(((
#
:name
.
,
name
)
(
#
:link
.
,
(
string-append
"/jobset/"
name
))))))))
((
"eval"
id
)
((
'GET
"eval"
id
)
(
let*
((
params
(
request-parameters
request
))
(
status
(
assq-ref
params
'status
))
(
builds-id-max
(
db-get-builds-max
id
status
))
...
...
@@ -447,13 +445,13 @@ Hydra format."
(
#
:link
.
,
(
string-append
"/eval/"
id
)))))))
(
respond-html-eval-not-found
id
))))
((
"eval"
(
=
string->number
id
)
"log"
"raw"
)
((
'GET
"eval"
(
=
string->number
id
)
"log"
"raw"
)
(
let
((
log
(
and
id
(
evaluation-log-file
id
))))
(
if
(
and
log
(
file-exists?
log
))
(
respond-gzipped-file
log
)
(
respond-not-found
(
uri->string
(
request-uri
request
))))))
((
"search"
)
((
'GET
"search"
)
(
let*
((
params
(
request-parameters
request
))
(
query
(
and=>
(
assq-ref
params
'query
)
uri-decode
))
(
builds-id-min
(
and=>
query
db-get-builds-query-min
))
...
...
@@ -479,11 +477,8 @@ Hydra format."
query
))
(
respond-json-with-error
500
"Query parameter not provided!"
))))
((
"static"
path
...
)
((
'GET
"static"
path
...
)
(
respond-static-file
path
))
(
'method-not-allowed
;; 405 "Method Not Allowed"
(
values
(
build-response
#
:code
405
)
#f
#f
))
(
_
(
respond-not-found
(
uri->string
(
request-uri
request
))))))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment