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

handling of route #60

Open
4 tasks
craff opened this issue Feb 9, 2023 · 11 comments
Open
4 tasks

handling of route #60

craff opened this issue Feb 9, 2023 · 11 comments

Comments

@craff
Copy link
Contributor

craff commented Feb 9, 2023

I have made several improvements (?) to route handling in simple_httpd you might want to use for tiny_httpd:

  • I have fixed an order on route: more precise first (currently, it is reverse of the order of add_route)
  • I dispatch using a tree for the method and the exact prefix of the route.
  • if no method is specified, it means GET|POST|HEAD but not PUT and DELETE
  • I removed the distinction between url_encode or not, I think it is simpler to always accept url_encoded path ?
@c-cube
Copy link
Owner

c-cube commented Feb 13, 2023

Do you still use a GADT for typing paths? wrt the tree?

Otherwise: I don't like removing the url_encode choice. Something you may want a raw string, and sometimes not. For the most part I'm worried I'll have to modify my existing projects that use tiny_httpd…

@craff
Copy link
Contributor Author

craff commented Feb 13, 2023 via email

@c-cube
Copy link
Owner

c-cube commented Feb 13, 2023

By the way, I now have an ADT for header names generated from a CSV from iana.

For common headers? That's pretty cool.

@c-cube
Copy link
Owner

c-cube commented Feb 13, 2023

Serious question: at what point is simple_httpd just a different project, anyway? It feels like you're doing a lot of work on it, it's faster, it leverages OCaml 5, etc. Maybe it's simpler to make simple_httpd an official project of yours?

@craff
Copy link
Contributor Author

craff commented Feb 13, 2023 via email

@craff
Copy link
Contributor Author

craff commented Feb 13, 2023 via email

@c-cube
Copy link
Owner

c-cube commented Feb 13, 2023

You mean, you don't accept custom headers at all? :o

Thank you for the reports. Indeed, the ones about chunk encoding, etc. are very useful. I need to work on them.

@craff
Copy link
Contributor Author

craff commented Feb 13, 2023 via email

@c-cube
Copy link
Owner

c-cube commented Feb 13, 2023

Is it compliant to reject custom headers? Or do you mean you just throw the parsing result away and move on to the next line?

I actually like the chunked encoding. If your body is a stream, it's just the cleaner way to go. And clients should be able to process either fixed size or chunked bodies anyway.

@craff
Copy link
Contributor Author

craff commented Feb 13, 2023 via email

@c-cube
Copy link
Owner

c-cube commented Feb 8, 2024

Hi @craff, I know it's been a while, but I've been revisiting issues :). I'd be interested in some parts of this actually!

  • using a tree for routing (if it keeps the same GADT)
  • always have urlencoded strings

for the use of combinators, I'd be interested in seeing what they look like/how they're implemented but I think it belongs in a separate discussion.

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

2 participants