/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return(digit);
}
+URLEncoder::URLEncoder()
+{
+}
+
+URLEncoder::~URLEncoder()
+{
+}
+
void URLEncoder::decode(char* s) const
{
register int x,y;
for(x=0,y=0;s[y];++x,++y)
{
- if((s[x] = s[y]) == '%')
+ if((s[x] = s[y]) == '%' && isxdigit(s[y+1]) && isxdigit(s[y+2]))
{
s[x] = x2c(&s[y+1]);
y+=2;
}
return ret;
}
+
+bool URLEncoder::isBad(char ch) const
+{
+ static char badchars[]="=&/?:\"\\+<>#%{}|^~[],`;@";
+ return (ch<=0x20 || ch>=0x7F || strchr(badchars,ch));
+}