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

Connection gets reset for HTTP POST (certain inputs) #27

Open
pidu opened this issue Apr 1, 2022 · 3 comments
Open

Connection gets reset for HTTP POST (certain inputs) #27

pidu opened this issue Apr 1, 2022 · 3 comments

Comments

@pidu
Copy link

pidu commented Apr 1, 2022

I ran into this the other day. Consider the following handler:

(ws-start
 (lambda (req)
  (with-slots (process headers) req
   (let ((is-post (assoc :POST headers)))
    (if is-post
     (progn
      (ws-response-header process 200
       '("Content-Type" . "text/plain; utf-8"))
      (process-send-string process (cdr (assoc "param" headers))))
     (progn
      (ws-response-header process 200
       '("Content-Type" . "text/html; charset=utf-8"))
      (process-send-string process
       (format "<!DOCTYPE html>
                <html>
                <body>
                <form method=%S>
                <textarea name=%S></textarea>
                <input type=%S value=%S />
                </form>
                </body>
                </html>" "post" "param" "submit" "Send")))))))
 9090)

Now visit for instance: https://www.gnu.org/software/emacs/manual/html_node/emacs/Coding-Systems.html

Copy the page contents, paste it into the the form and submit.

Behold, connection gets reset.

@pidu
Copy link
Author

pidu commented Apr 1, 2022

I haven't been able to determine why but it almost seems to be size-related. Copy smaller parts of the input and pasting them works fine.

@pidu
Copy link
Author

pidu commented Apr 1, 2022

Not sure if Emacs version makes a difference, but I ran into this on Emacs 27.1 and 27.2

@pidu
Copy link
Author

pidu commented Apr 1, 2022

Ah...it works with multipart/form-data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant