Remove layer of actor*, to avoid out-of-context field access; switch from 201 to 202 for posts
This commit is contained in:
parent
7dc47f53ff
commit
d2c161fd3e
|
@ -86,10 +86,9 @@
|
|||
(current-content body)
|
||||
(current-content-type content-type)
|
||||
(last-modified-seconds (current-seconds))
|
||||
(actor*
|
||||
(send! (notification self-url
|
||||
hub-url
|
||||
self-url
|
||||
body
|
||||
content-type))
|
||||
(web-respond/status! id 201 #"Created"))))))
|
||||
(send! (notification self-url
|
||||
hub-url
|
||||
self-url
|
||||
body
|
||||
content-type))
|
||||
(web-respond/status! id 202 #"Accepted")))))
|
||||
|
|
|
@ -178,23 +178,22 @@
|
|||
|
||||
(on (web-request-incoming (id req) (vh host-name port) 'post ("sub" (,sub-id ())) $body)
|
||||
;; TODO: verify the use of the shared secret
|
||||
(actor*
|
||||
(define parsed-link-headers (parse-link-headers (web-request-header-headers req)))
|
||||
(define upstream-hub (link-header-ref parsed-link-headers 'hub #f))
|
||||
(define upstream-topic (link-header-ref parsed-link-headers 'self #f))
|
||||
(define content-type (web-request-header-content-type req))
|
||||
(log-info "Remote topic ~a got ~v message ~v; upstream hub ~v, topic ~v"
|
||||
full-topic
|
||||
content-type
|
||||
body
|
||||
upstream-hub
|
||||
upstream-topic)
|
||||
(current-content-hash (sha1 (open-input-bytes body)))
|
||||
(current-content-type content-type)
|
||||
(current-upstream-hub upstream-hub)
|
||||
(send! (notification full-topic
|
||||
upstream-hub
|
||||
upstream-topic
|
||||
body
|
||||
content-type))
|
||||
(web-respond/status! id 201 #"Created"))))))
|
||||
(define parsed-link-headers (parse-link-headers (web-request-header-headers req)))
|
||||
(define upstream-hub (link-header-ref parsed-link-headers 'hub #f))
|
||||
(define upstream-topic (link-header-ref parsed-link-headers 'self #f))
|
||||
(define content-type (web-request-header-content-type req))
|
||||
(web-respond/status! id 202 #"Accepted")
|
||||
(log-info "Remote topic ~a got ~v message ~v; upstream hub ~v, topic ~v"
|
||||
full-topic
|
||||
content-type
|
||||
body
|
||||
upstream-hub
|
||||
upstream-topic)
|
||||
(current-content-hash (sha1 (open-input-bytes body)))
|
||||
(current-content-type content-type)
|
||||
(current-upstream-hub upstream-hub)
|
||||
(send! (notification full-topic
|
||||
upstream-hub
|
||||
upstream-topic
|
||||
body
|
||||
content-type))))))
|
||||
|
|
Loading…
Reference in New Issue