title: Efficient string parsing in C for Web Routing
body: <p>I'm writing a tiny hook for a super old web server that can't otherwise be upgraded (except manually like this). It is written in C and provides enough barebones stuff - set headers, mime types, etc. It does its own routing but can only return static files.</p>
  
  <p>I have tested a simple web routing system that just uses <code>strstr</code> to see if a certain request was called; then I return some JSON data. What I would like to know is how to efficiently write a web routing process from scratch. My product is very specialized and only has one user on it at a time, and web access is often just for setup, so I'm not at all worried about 100s of requests per second. The max could be 5-10 requests per second for a tiny burst, then maybe 1 request per second while idle.</p>
  
  <p>I think this gets in to things like tokenizing, or maybe just using regexps.. Things I will learn if necessary.</p>
  
  <p>TLDR: How do I write this in the most efficient manner?</p>
  
  <pre><code>  /* requestPtr-&gt;path = "/user/123" */
  
     if(strstr(requestPtr-&gt;path, "/user/123") != NULL)
     {
         /* process the request */
     }
     else if(strstr(requestPtr-&gt;path, "/config/settings") != NULL)
     {
         /* process the request */
     }
     else if(/* and on and on */ )...
  </code></pre>