ring

How can I use ring anti-forgery / CSRF token with latest version ring/compojure?

陌路散爱 提交于 2019-12-05 04:19:30
I copied some old code that was working in compojure 1.1.18 and other old libs, but using the latest versions I can't get it to work. Here's my minimal example code copied from the minimal example here to demonstrate that with latest ring and compojure libraries, I get an error when I send an http POST , even with the header set. lein ring server to start it, then do curl -X GET --cookie-jar cookies "http://localhost:3000/" which results in something like this: {"csrf-token":"7JnNbzx8BNG/kAeH4bz1jDdGc7zPC4TddDyiyPGX3jmpVilhyXJ7AOjfJgeQllGthFeVS/rgG4GpkUaF"} But when I do this curl -X POST -v -

Clojure/Ring: Using the ring jetty adapter, large requests give me a 413: FULL HEAD error.

会有一股神秘感。 提交于 2019-12-05 02:05:36
问题 Using Ring's Jetty adapter, if my request is too large I get a 413: FULL HEAD error. I tracked it down to a property called headerbuffersize, but when I try to set it in the run-jetty call, I still get the 413's. Is there a better way to control jetty config from Ring? (ring/run-jetty (var app) {:port port :join? false :headerbuffersize 1048576}) What is the right way to do this? Thanks! 回答1: I think this should work: (def header-buffer-size 1048576) (def config {:host "example.com" :port

Win64 驱动内核编程-7.内核里操作进程

我们两清 提交于 2019-12-04 13:24:41
在内核里操作进程 在内核里操作进程,相信是很多对 WINDOWS 内核编程感兴趣的朋友第一个学习的知识点。但在这里,我要让大家失望了,在内核里操作进程没什么特别的,就标准方法而言,还是调用那几个和进程相关的 NATIVE API 而已(当然了,本文所说的进程操作,还包括对线程和 DLL 模块的操作)。本文包括 10 个部分:分别是:枚举进程、暂停进程、恢复进程、结束进程、枚举线程、暂停线程、恢复线程、结束线程、枚举 DLL 模块、卸载 DLL 模块。 1.枚举进程。进程就是活动起来的程序。每一个进程在内核里,都有一个名为 EPROCESS 的巨大结构体记录它的详细信息,包括它的名字,编号(PID),出生地点(进程路径),老爹是谁(PPID 或父进程 ID)等。在 RING3 枚举进程,通常只要列出所有进程的编号即可。不过在 RING0 里,我们还要把它的身份证(EPROCESS)地址给列举出来。顺带说一句, 现实中男人最怕的事情 就是“ 喜当爹” , 这种事情在内核里更加容易发生。因为 EPROCESS 里 有 且只有 一个 成员 是记录父进程 ID 的,稍微改一下,就可以认任意进程为爹了。枚举进程的方法很多,标准方法是使用 ZwQuerySystemInformation 的 SystemProcessInformation 功能号,不过如果在内核里也这么用的话

lein ring server with nrepl doesn't honour cider-nrepl

你离开我真会死。 提交于 2019-12-04 07:51:10
When I start up my current project with lein ring server and try to connect to it from Emacs via cider, I get the following warning: ; CIDER 0.8.2 (Java 1.7.0_51, Clojure 1.6.0, nREPL 0.2.6) WARNING: The following required nREPL ops are not supported: apropos classpath complete eldoc info inspect-start inspect-refresh inspect-pop inspect-push inspect-reset macroexpand ns-list ns-vars resource stacktrace toggle-trace-var toggle-trace-ns undef Please, install (or update) cider-nrepl 0.8.2 and restart CIDER user> However, I do have a dependency for [cider/cider-nrepl "0.8.2"] in my project.clj .

Serving app and api routes with different middleware using Ring and Compojure

我们两清 提交于 2019-12-03 16:16:52
问题 I have a ring+compojure application and I want to apply different middleware depending on whether the route is part of the web application or part of the api (which is json based). I found some answers to this question on stack overflow and other forums, but these answers seem more complicated than the solution I've been using. I wanted to know if there are drawbacks with how I'm doing it and what I may be missing in my solution. A very simplified version of what I'm doing is (defroutes app

How do I configure nginx as proxy to jetty?

若如初见. 提交于 2019-12-03 11:58:41
问题 I've been trying to set up nginx as proxy to jetty. I want to do something as explained in this answer but for Jetty not ring. I've created a .war and I placed it in ~/jetty/jetty-dist/webapps/web_test-0.1.0-SNAPSHOT-standalone.war Say, I want to use the domain example.com with ip address 198.51.100.0. I've also copied /etc/nginx/sites-available/default into the file example.com and I have it in the same directory. Can you help me configure nginx as proxy to jetty in my case? I know there are

clojure/ring/jetty: I am using > lein ring server. How do I configure the jetty instance that gets instantiated?

夙愿已清 提交于 2019-12-03 10:29:15
问题 When I was calling the jetty handler directly, I was able to pass in a configurator like so: (def header-buffer-size 8388608) (defn start [port] (ring/run-jetty (var app) {:port port :join? false :host "127.0.0.1" :configurator (fn [jetty] (doseq [connector (.getConnectors jetty)] (.setHeaderBufferSize connector header-buffer-size)))})) I had to do this because I kept getting a FULL HEAD error when posting. Now I refactored things to use > lein ring server directly, which gets called from the

Serving app and api routes with different middleware using Ring and Compojure

可紊 提交于 2019-12-03 06:18:25
I have a ring+compojure application and I want to apply different middleware depending on whether the route is part of the web application or part of the api (which is json based). I found some answers to this question on stack overflow and other forums, but these answers seem more complicated than the solution I've been using. I wanted to know if there are drawbacks with how I'm doing it and what I may be missing in my solution. A very simplified version of what I'm doing is (defroutes app-routes (GET "/" [req] dump-req) (route/not-found "Not Found")) (defroutes api-routes (GET "/api" [req]

Can I make a fully non-blocking backend application with http-kit and core.async?

你离开我真会死。 提交于 2019-12-03 01:39:47
问题 I'm wondering if it's possible to put together a fully non-blocking Clojure backend web application with http-kit. (Actually any Ring-compatible http server would be fine by me; I'm mentioning http-kit because it claims to have an event-driven, non-blocking model). EDIT: TL;DR This question is a symptom of some misconceptions I had about the nature of non-blocking/asynchronous/event-driven systems. In case you're in the same place as I was, here are some clarifications. Making an event-driven

clojure/ring/jetty: I am using > lein ring server. How do I configure the jetty instance that gets instantiated?

时间秒杀一切 提交于 2019-12-03 01:05:08
When I was calling the jetty handler directly, I was able to pass in a configurator like so: (def header-buffer-size 8388608) (defn start [port] (ring/run-jetty (var app) {:port port :join? false :host "127.0.0.1" :configurator (fn [jetty] (doseq [connector (.getConnectors jetty)] (.setHeaderBufferSize connector header-buffer-size)))})) I had to do this because I kept getting a FULL HEAD error when posting. Now I refactored things to use > lein ring server directly, which gets called from the command line. > lein ring server This uses some configuration specified in my project.clj: :ring {