* own command line parser for RewriteRule and RewriteCond, * which doesn't have the '\\' problem. * (returns true on error) * * XXX: what an inclined parser. Seems we have to leave it so * for backwards compat. *sigh* */
| 2928 | * for backwards compat. *sigh* |
| 2929 | */ |
| 2930 | static int parseargline(char *str, char **a1, char **a2, char **a2_end, char **a3) |
| 2931 | { |
| 2932 | char quote; |
| 2933 | |
| 2934 | while (apr_isspace(*str)) { |
| 2935 | ++str; |
| 2936 | } |
| 2937 | |
| 2938 | /* |
| 2939 | * determine first argument |
| 2940 | */ |
| 2941 | quote = (*str == '"' || *str == '\'') ? *str++ : '\0'; |
| 2942 | *a1 = str; |
| 2943 | |
| 2944 | for (; *str; ++str) { |
| 2945 | if ((apr_isspace(*str) && !quote) || (*str == quote)) { |
| 2946 | break; |
| 2947 | } |
| 2948 | if (*str == '\\' && apr_isspace(str[1])) { |
| 2949 | ++str; |
| 2950 | continue; |
| 2951 | } |
| 2952 | } |
| 2953 | |
| 2954 | if (!*str) { |
| 2955 | return 1; |
| 2956 | } |
| 2957 | *str++ = '\0'; |
| 2958 | |
| 2959 | while (apr_isspace(*str)) { |
| 2960 | ++str; |
| 2961 | } |
| 2962 | |
| 2963 | /* |
| 2964 | * determine second argument |
| 2965 | */ |
| 2966 | quote = (*str == '"' || *str == '\'') ? *str++ : '\0'; |
| 2967 | *a2 = str; |
| 2968 | |
| 2969 | for (; *str; ++str) { |
| 2970 | if ((apr_isspace(*str) && !quote) || (*str == quote)) { |
| 2971 | break; |
| 2972 | } |
| 2973 | if (*str == '\\' && apr_isspace(str[1])) { |
| 2974 | ++str; |
| 2975 | continue; |
| 2976 | } |
| 2977 | } |
| 2978 | |
| 2979 | if (!*str) { |
| 2980 | *a3 = NULL; /* 3rd argument is optional */ |
| 2981 | *a2_end = str; |
| 2982 | return 0; |
| 2983 | } |
| 2984 | *a2_end = str; |
| 2985 | *str++ = '\0'; |
| 2986 | |
| 2987 | while (apr_isspace(*str)) { |
no outgoing calls
no test coverage detected