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

Use 3rd party HTTP and XML parsing library? #347

Open
DimitriPapadopoulos opened this issue Jul 9, 2018 · 8 comments
Open

Use 3rd party HTTP and XML parsing library? #347

DimitriPapadopoulos opened this issue Jul 9, 2018 · 8 comments

Comments

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Jul 9, 2018

Would it make sense to use 3rd party HTTP and XML parsing libraries instead of maintaining our own code?

Examples of 3rd party libraries for HTTP:

For XML:

  • Yxml - no memory allocation, faster than expat, and only two files yxml.h and yxml.c.
@mrbaseman
Copy link
Collaborator

hmm... for what reason?

  • more features / flexibility that a 3rd party library provides?
  • issues we have/had with our own code which are properly handled there (if so, which ones?)?
  • just to shrink our code and do outsourcing of this particular task?

personally, if the code for a particular feature is not too large, I prefer to maintain it locally for the following reasons:

  • it's probably easier to understand and debug than a "black box" that is supposed to do a particular task
  • we stay flexible to extend it on demand according to our requirements
  • it's more portable than external libraries that might not exist on some platform

I'm not strictly against 3rd party libraries, just expressing my vague feelings about this topic

@DimitriPapadopoulos
Copy link
Collaborator Author

DimitriPapadopoulos commented Jul 13, 2018

Only this one:

  • just to shrink our code and do outsourcing of this particular task

Both HTTP parsers are at least as portable as openfortivpn. Just a suggestion though, no necessity to implement that.

@mrbaseman
Copy link
Collaborator

hmm... we would replace (large) parts of http.c. But we would presumably bundle the parser with openfortivpn, and redistribute it together with our source, right?

@DimitriPapadopoulos
Copy link
Collaborator Author

Yes, that's what I had in mind. Linux packages might want to link to a library though.

@mrbaseman
Copy link
Collaborator

good point: if the external library provides more detailed error messages. On the other hand one could just print out res to stderr before freeing it here, at least in the verbose mode.
But maybe this is just one more advantage of an external library, and there are many more if we just look close enough...

@mrbaseman
Copy link
Collaborator

string parsing could also be done by an external library (see #502)

@DimitriPapadopoulos
Copy link
Collaborator Author

DimitriPapadopoulos commented Mar 20, 2020

#575: one more reason to use external files/libraries for everything that is not core functionality, for example HTTP or XML parsing.

@DimitriPapadopoulos
Copy link
Collaborator Author

DimitriPapadopoulos commented Apr 15, 2020

#640 cleans up http_receive(), preparing the way for a possible PicoHTTPParser integration. At this point it's not yet clear if a foreign HTTP parsing library will result in less and more efficient code. The HTTP parsing code is currently specific and goal-oriented, hence quite efficient and simple. Not certain more general 3rd party code will be better.

@DimitriPapadopoulos DimitriPapadopoulos changed the title Use 3rd party HTTP parsing library? Use 3rd party HTTP and XML parsing library? Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants