/[jscoverage]/trunk/http-url.c
ViewVC logotype

Diff of /trunk/http-url.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 116 by siliconforks, Sat May 31 21:42:36 2008 UTC revision 254 by siliconforks, Sun Oct 5 18:09:32 2008 UTC
# Line 21  Line 21 
21    
22  #include "http-server.h"  #include "http-server.h"
23    
24    #include <ctype.h>
25  #include <string.h>  #include <string.h>
26    
27  #include "util.h"  #include "util.h"
# Line 81  Line 82 
82    return 0;    return 0;
83  }  }
84    
   
85  int URL_parse(const char * url, char ** host, uint16_t * port, char ** abs_path, char ** query) {  int URL_parse(const char * url, char ** host, uint16_t * port, char ** abs_path, char ** query) {
86      /* check for invalid characters */
87      for (const char * p = url; *p != '\0'; p++) {
88        switch (*p) {
89        case ';':
90        case '/':
91        case '?':
92        case ':':
93        case '@':
94        case '&':
95        case '=':
96        case '+':
97        case '$':
98        case ',':
99        case '-':
100        case '_':
101        case '.':
102        case '!':
103        case '~':
104        case '*':
105        case '\'':
106        case '(':
107        case ')':
108        case '%':
109          break;
110        default:
111          if (! isalnum(*p)) {
112            return -1;
113          }
114          break;
115        }
116      }
117    
118    int result;    int result;
119    if (strncasecmp(url, "http://", 7) == 0) {    if (strncasecmp(url, "http://", 7) == 0) {
120      /* absoluteURI */      /* absoluteURI */

Legend:
Removed from v.116  
changed lines
  Added in v.254

  ViewVC Help
Powered by ViewVC 1.1.24