PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - lcov_data/ext/standard - url_scanner_ex.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 115 152 75.7 %
Date: 2016-09-27 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Generated by re2c 0.13.5 */
       2             : #line 1 "ext/standard/url_scanner_ex.re"
       3             : /*
       4             :   +----------------------------------------------------------------------+
       5             :   | PHP Version 7                                                        |
       6             :   +----------------------------------------------------------------------+
       7             :   | Copyright (c) 1997-2016 The PHP Group                                |
       8             :   +----------------------------------------------------------------------+
       9             :   | This source file is subject to version 3.01 of the PHP license,      |
      10             :   | that is bundled with this package in the file LICENSE, and is        |
      11             :   | available through the world-wide-web at the following url:           |
      12             :   | http://www.php.net/license/3_01.txt                                  |
      13             :   | If you did not receive a copy of the PHP license and are unable to   |
      14             :   | obtain it through the world-wide-web, please send a note to          |
      15             :   | license@php.net so we can mail you a copy immediately.               |
      16             :   +----------------------------------------------------------------------+
      17             :   | Author: Sascha Schumann <sascha@schumann.cx>                         |
      18             :   |         Yasuo Ohgaki <yohgaki@ohgaki.net>                            |
      19             :   +----------------------------------------------------------------------+
      20             : */
      21             : 
      22             : /* $Id$ */
      23             : 
      24             : #include "php.h"
      25             : 
      26             : #ifdef HAVE_UNISTD_H
      27             : #include <unistd.h>
      28             : #endif
      29             : #ifdef HAVE_LIMITS_H
      30             : #include <limits.h>
      31             : #endif
      32             : 
      33             : #include <stdio.h>
      34             : #include <stdlib.h>
      35             : #include <string.h>
      36             : 
      37             : #include "SAPI.h"
      38             : #include "php_ini.h"
      39             : #include "php_globals.h"
      40             : #include "php_string.h"
      41             : #define STATE_TAG SOME_OTHER_STATE_TAG
      42             : #include "basic_functions.h"
      43             : #include "url.h"
      44             : #include "html.h"
      45             : #undef STATE_TAG
      46             : 
      47             : #define url_scanner url_scanner_ex
      48             : 
      49             : #include "zend_smart_str.h"
      50             : 
      51             : static void tag_dtor(zval *zv)
      52             : {
      53             :         free(Z_PTR_P(zv));
      54             : }
      55             : 
      56             : static int php_ini_on_update_tags(zend_ini_entry *entry, zend_string *new_value, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage, int type)
      57             : {
      58             :         url_adapt_state_ex_t *ctx;
      59             :         char *key;
      60             :         char *tmp;
      61             :         char *lasts = NULL;
      62             : 
      63             :         if (type) {
      64             :                 ctx = &BG(url_adapt_session_ex);
      65             :         } else {
      66             :                 ctx = &BG(url_adapt_output_ex);
      67             :         }
      68             : 
      69             :         tmp = estrndup(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
      70             : 
      71             :         if (ctx->tags)
      72             :                 zend_hash_destroy(ctx->tags);
      73             :         else {
      74             :                 ctx->tags = malloc(sizeof(HashTable));
      75             :                 if (!ctx->tags) {
      76             :                         efree(tmp);
      77             :                         return FAILURE;
      78             :                 }
      79             :         }
      80             : 
      81             :         zend_hash_init(ctx->tags, 0, NULL, tag_dtor, 1);
      82             : 
      83             :         for (key = php_strtok_r(tmp, ",", &lasts);
      84             :                  key;
      85             :                  key = php_strtok_r(NULL, ",", &lasts)) {
      86             :                 char *val;
      87             : 
      88             :                 val = strchr(key, '=');
      89             :                 if (val) {
      90             :                         char *q;
      91             :                         size_t keylen;
      92             : 
      93             :                         *val++ = '\0';
      94             :                         for (q = key; *q; q++) {
      95             :                                 *q = tolower(*q);
      96             :                         }
      97             :                         keylen = q - key;
      98             :                         zend_hash_str_add_mem(ctx->tags, key, keylen, val, strlen(val)+1);
      99             :                 }
     100             :         }
     101             : 
     102             :         efree(tmp);
     103             : 
     104             :         return SUCCESS;
     105             : }
     106             : 
     107             : static PHP_INI_MH(OnUpdateSessionTags)
     108             : {
     109             :         return php_ini_on_update_tags(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, 1);
     110             : }
     111             : 
     112             : static PHP_INI_MH(OnUpdateOutputTags)
     113             : {
     114             :         return php_ini_on_update_tags(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, 0);
     115             : }
     116             : 
     117             : static int php_ini_on_update_hosts(zend_ini_entry *entry, zend_string *new_value, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage, int type)
     118             : {
     119             :         HashTable *hosts;
     120             :         char *key;
     121             :         char *tmp;
     122             :         char *lasts = NULL;
     123             : 
     124             :         if (type) {
     125             :                 hosts = &BG(url_adapt_session_hosts_ht);
     126             :         } else {
     127             :                 hosts = &BG(url_adapt_output_hosts_ht);
     128             :         }
     129             :         zend_hash_clean(hosts);
     130             : 
     131             :         /* Use user supplied host whitelist */
     132             :         tmp = estrndup(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
     133             :         for (key = php_strtok_r(tmp, ",", &lasts);
     134             :                  key;
     135             :                  key = php_strtok_r(NULL, ",", &lasts)) {
     136             :                 size_t keylen;
     137             :                 zend_string *tmp_key;
     138             :                 char *q;
     139             : 
     140             :                 for (q = key; *q; q++) {
     141             :                         *q = tolower(*q);
     142             :                 }
     143             :                 keylen = q - key;
     144             :                 if (keylen > 0) {
     145             :                         tmp_key = zend_string_init(key, keylen, 0);
     146             :                         zend_hash_add_empty_element(hosts, tmp_key);
     147             :                         zend_string_release(tmp_key);
     148             :                 }
     149             :         }
     150             :         efree(tmp);
     151             : 
     152             :         return SUCCESS;
     153             : }
     154             : 
     155             : static PHP_INI_MH(OnUpdateSessionHosts)
     156             : {
     157             :         return php_ini_on_update_hosts(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, 1);
     158             : }
     159             : 
     160             : static PHP_INI_MH(OnUpdateOutputHosts)
     161             : {
     162             :         return php_ini_on_update_hosts(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, 0);
     163             : }
     164             : 
     165             : /* FIXME: OnUpdate*Hosts cannot set default to $_SERVER['HTTP_HOST'] at startup */
     166             : PHP_INI_BEGIN()
     167             :         STD_PHP_INI_ENTRY("session.trans_sid_tags", "a=href,area=href,frame=src,form=", PHP_INI_ALL, OnUpdateSessionTags, url_adapt_session_ex, php_basic_globals, basic_globals)
     168             :         STD_PHP_INI_ENTRY("session.trans_sid_hosts", "", PHP_INI_ALL, OnUpdateSessionHosts, url_adapt_session_hosts_ht, php_basic_globals, basic_globals)
     169             :         STD_PHP_INI_ENTRY("url_rewriter.tags", "form=", PHP_INI_ALL, OnUpdateOutputTags, url_adapt_session_ex, php_basic_globals, basic_globals)
     170             :         STD_PHP_INI_ENTRY("url_rewriter.hosts", "", PHP_INI_ALL, OnUpdateOutputHosts, url_adapt_session_hosts_ht, php_basic_globals, basic_globals)
     171             : PHP_INI_END()
     172             : 
     173             : #line 177 "ext/standard/url_scanner_ex.re"
     174             : 
     175             : 
     176             : #define YYFILL(n) goto done
     177             : #define YYCTYPE unsigned char
     178             : #define YYCURSOR p
     179             : #define YYLIMIT q
     180             : #define YYMARKER r
     181             : 
     182             : static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *url_app, const char *separator)
     183             : {
     184             :         php_url *url_parts;
     185             :         char *tmp;
     186             :         size_t tmp_len;
     187             : 
     188             :         smart_str_0(url); /* FIXME: Bug #70480 php_url_parse_ex() crashes by processing chars exceed len */
     189             :         url_parts = php_url_parse_ex(ZSTR_VAL(url->s), ZSTR_LEN(url->s));
     190             : 
     191             :         /* Ignore malformed URLs */
     192             :         if (!url_parts) {
     193             :                 smart_str_append_smart_str(dest, url);
     194             :                 return;
     195             :         }
     196             : 
     197             :         /* Check protocol. Only http/https is allowed. */
     198             :         if (url_parts->scheme
     199             :                 && strcasecmp("http", url_parts->scheme)
     200             :                 && strcasecmp("https", url_parts->scheme)) {
     201             :                 smart_str_append_smart_str(dest, url);
     202             :                 php_url_free(url_parts);
     203             :                 return;
     204             :         }
     205             : 
     206             :         /* Check host whitelist. If it's not listed, do nothing. */
     207             :         if (url_parts->host
     208             :                 && (tmp_len = strlen(url_parts->host))
     209             :                 && (tmp = php_strtolower(url_parts->host, tmp_len))
     210             :                 && !zend_hash_str_find(&BG(url_adapt_session_hosts_ht), tmp, tmp_len)) {
     211             :                 smart_str_append_smart_str(dest, url);
     212             :                 php_url_free(url_parts);
     213             :                 return;
     214             :         }
     215             : 
     216             :         /*
     217             :          * When URL does not have path and query string add "/?".
     218             :          * i.e. If URL is only "?foo=bar", should not add "/?".
     219             :          */
     220             :         if (!url_parts->path && !url_parts->query) {
     221             :                 /* URL is http://php.net or like */
     222             :                 smart_str_append_smart_str(dest, url);
     223             :                 smart_str_appendc(dest, '/');
     224             :                 smart_str_appendc(dest, '?');
     225             :                 smart_str_append_smart_str(dest, url_app);
     226             :                 /* There should not be fragment. Just return */
     227             :                 php_url_free(url_parts);
     228             :                 return;
     229             :         }
     230             : 
     231             :         if (url_parts->scheme) {
     232             :                 smart_str_appends(dest, url_parts->scheme);
     233             :                 smart_str_appends(dest, "://");
     234             :         } else if (*(ZSTR_VAL(url->s)) == '/' && *(ZSTR_VAL(url->s)+1) == '/') {
     235             :                 smart_str_appends(dest, "//");
     236             :         }
     237             :         if (url_parts->user) {
     238             :                 smart_str_appends(dest, url_parts->user);
     239             :                 if (url_parts->pass) {
     240             :                         smart_str_appends(dest, url_parts->pass);
     241             :                         smart_str_appendc(dest, ':');
     242             :                 }
     243             :                 smart_str_appendc(dest, '@');
     244             :         }
     245             :         if (url_parts->host) {
     246             :                                 smart_str_appends(dest, url_parts->host);
     247             :         }
     248             :         if (url_parts->port) {
     249             :                 smart_str_appendc(dest, ':');
     250             :                 smart_str_append_unsigned(dest, (long)url_parts->port);
     251             :         }
     252             :         if (url_parts->path) {
     253             :                 smart_str_appends(dest, url_parts->path);
     254             :         }
     255             :         smart_str_appendc(dest, '?');
     256             :         if (url_parts->query) {
     257             :                 smart_str_appends(dest, url_parts->query);
     258             :                 smart_str_appends(dest, separator);
     259             :                 smart_str_append_smart_str(dest, url_app);
     260             :         } else {
     261             :                 smart_str_append_smart_str(dest, url_app);
     262             :         }
     263             :         if (url_parts->fragment) {
     264             :                 smart_str_appendc(dest, '#');
     265             :                 smart_str_appends(dest, url_parts->fragment);
     266             :         }
     267             :         php_url_free(url_parts);
     268             : }
     269             : 
     270             : enum {
     271             :         TAG_NORMAL = 0,
     272             :         TAG_FORM
     273             : };
     274             : 
     275             : enum {
     276             :         ATTR_NORMAL = 0,
     277             :         ATTR_ACTION
     278             : };
     279             : 
     280             : #undef YYFILL
     281             : #undef YYCTYPE
     282             : #undef YYCURSOR
     283             : #undef YYLIMIT
     284             : #undef YYMARKER
     285             : 
     286             : static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type)
     287             : {
     288             :         char f = 0;
     289             : 
     290             :         /* arg.s is string WITHOUT NUL.
     291             :            To avoid partial match, NUL is added here */
     292             :         ZSTR_VAL(ctx->arg.s)[ZSTR_LEN(ctx->arg.s)] = '\0';
     293             :         if (!strcasecmp(ZSTR_VAL(ctx->arg.s), ctx->lookup_data)) {
     294             :                 f = 1;
     295             :         }
     296             : 
     297             :         if (quotes) {
     298             :                 smart_str_appendc(&ctx->result, type);
     299             :         }
     300             :         if (f) {
     301             :                 append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output);
     302             :         } else {
     303             :                 smart_str_append_smart_str(&ctx->result, &ctx->val);
     304             :         }
     305             :         if (quotes) {
     306             :                 smart_str_appendc(&ctx->result, type);
     307             :         }
     308             : }
     309             : 
     310             : enum {
     311             :         STATE_PLAIN = 0,
     312             :         STATE_TAG,
     313             :         STATE_NEXT_ARG,
     314             :         STATE_ARG,
     315             :         STATE_BEFORE_VAL,
     316             :         STATE_VAL
     317             : };
     318             : 
     319             : #define YYFILL(n) goto stop
     320             : #define YYCTYPE unsigned char
     321             : #define YYCURSOR xp
     322             : #define YYLIMIT end
     323             : #define YYMARKER q
     324             : #define STATE ctx->state
     325             : 
     326             : #define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR
     327             : #define STD_ARGS ctx, start, xp
     328             : 
     329             : #if SCANNER_DEBUG
     330             : #define scdebug(x) printf x
     331             : #else
     332             : #define scdebug(x)
     333             : #endif
     334             : 
     335             : static inline void passthru(STD_PARA)
     336             : {
     337             :         scdebug(("appending %d chars, starting with %c\n", YYCURSOR-start, *start));
     338             :         smart_str_appendl(&ctx->result, start, YYCURSOR - start);
     339             : }
     340             : 
     341             : 
     342             : static int check_http_host(char *target)
     343             : {
     344             :         zval *host, *tmp;
     345             :         zend_string *host_tmp;
     346             :         char *colon;
     347             : 
     348             :         if ((tmp  = zend_hash_str_find(&EG(symbol_table), ZEND_STRL("_SERVER"))) &&
     349             :                 (host = zend_hash_str_find(Z_ARRVAL_P(tmp), ZEND_STRL("HTTP_HOST"))) &&
     350             :                 Z_TYPE_P(host) == IS_STRING) {
     351             :                 host_tmp = zend_string_init(Z_STRVAL_P(host), Z_STRLEN_P(host), 0);
     352             :                 /* HTTP_HOST could be 'localhost:8888' etc. */
     353             :                 colon = strchr(ZSTR_VAL(host_tmp), ':');
     354             :                 if (colon) {
     355             :                         ZSTR_LEN(host_tmp) = colon - ZSTR_VAL(host_tmp);
     356             :                         ZSTR_VAL(host_tmp)[ZSTR_LEN(host_tmp)] = '\0';
     357             :                 }
     358             :                 if (!strcasecmp(ZSTR_VAL(host_tmp), target)) {
     359             :                         zend_string_release(host_tmp);
     360             :                         return SUCCESS;
     361             :                 }
     362             :                 zend_string_release(host_tmp);
     363             :         }
     364             :         return FAILURE;
     365             : }
     366             : 
     367             : static int check_host_whitelist(url_adapt_state_ex_t *ctx)
     368             : {
     369             :         php_url *url_parts = NULL;
     370             :         HashTable *allowed_hosts = ctx->type ? &BG(url_adapt_session_hosts_ht) : &BG(url_adapt_output_hosts_ht);
     371             : 
     372             :         ZEND_ASSERT(ctx->tag_type == TAG_FORM);
     373             : 
     374             :         if (ctx->attr_val.s && ZSTR_LEN(ctx->attr_val.s)) {
     375             :                 url_parts = php_url_parse_ex(ZSTR_VAL(ctx->attr_val.s), ZSTR_LEN(ctx->attr_val.s));
     376             :         } else {
     377             :                 return SUCCESS; /* empty URL is valid */
     378             :         }
     379             : 
     380             :         if (!url_parts) {
     381             :                 return FAILURE;
     382             :         }
     383             :         if (url_parts->scheme) {
     384             :                 /* Only http/https should be handled.
     385             :                    A bit hacky check this here, but saves a URL parse. */
     386             :                 if (strcasecmp(url_parts->scheme, "http") &&
     387             :                         strcasecmp(url_parts->scheme, "https")) {
     388             :                 php_url_free(url_parts);
     389             :                 return FAILURE;
     390             :                 }
     391             :         }
     392             :         if (!url_parts->host) {
     393             :                 php_url_free(url_parts);
     394             :                 return SUCCESS;
     395             :         }
     396             :         if (!zend_hash_num_elements(allowed_hosts) &&
     397             :                 check_http_host(url_parts->host) == SUCCESS) {
     398             :                 php_url_free(url_parts);
     399             :                 return SUCCESS;
     400             :         }
     401             :         if (!zend_hash_str_find(allowed_hosts,
     402             :                                                         url_parts->host,
     403             :                                                         strlen(url_parts->host))) {
     404             :                 php_url_free(url_parts);
     405             :                 return FAILURE;
     406             :         }
     407             :         php_url_free(url_parts);
     408             :         return SUCCESS;
     409             : }
     410             : 
     411             : /*
     412             :  * This function appends a hidden input field after a <form>.
     413             :  */
     414             : static void handle_form(STD_PARA)
     415             : {
     416             :         int doit = 0;
     417             : 
     418             :         if (ZSTR_LEN(ctx->form_app.s) > 0) {
     419             :                 switch (ZSTR_LEN(ctx->tag.s)) {
     420             :                         case sizeof("form") - 1:
     421             :                                 if (!strncasecmp(ZSTR_VAL(ctx->tag.s), "form", ZSTR_LEN(ctx->tag.s))
     422             :                                         && check_host_whitelist(ctx) == SUCCESS) {
     423             :                                         doit = 1;
     424             :                                 }
     425             :                                 break;
     426             :                 }
     427             :         }
     428             : 
     429             :         if (doit) {
     430             :                 smart_str_append_smart_str(&ctx->result, &ctx->form_app);
     431             :         }
     432             : }
     433             : 
     434             : /*
     435             :  *  HANDLE_TAG copies the HTML Tag and checks whether we
     436             :  *  have that tag in our table. If we might modify it,
     437             :  *  we continue to scan the tag, otherwise we simply copy the complete
     438             :  *  HTML stuff to the result buffer.
     439             :  */
     440             : 
     441             : static inline void handle_tag(STD_PARA)
     442             : {
     443             :         int ok = 0;
     444             :         unsigned int i;
     445             : 
     446             :         if (ctx->tag.s) {
     447             :                 ZSTR_LEN(ctx->tag.s) = 0;
     448             :         }
     449             :         smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
     450             :         for (i = 0; i < ZSTR_LEN(ctx->tag.s); i++)
     451             :                 ZSTR_VAL(ctx->tag.s)[i] = tolower((int)(unsigned char)ZSTR_VAL(ctx->tag.s)[i]);
     452             :     /* intentionally using str_find here, in case the hash value is set, but the string val is changed later */
     453             :         if ((ctx->lookup_data = zend_hash_str_find_ptr(ctx->tags, ZSTR_VAL(ctx->tag.s), ZSTR_LEN(ctx->tag.s))) != NULL) {
     454             :                 ok = 1;
     455             :                 if (ZSTR_LEN(ctx->tag.s) == sizeof("form")-1
     456             :                         && !strncasecmp(ZSTR_VAL(ctx->tag.s), "form", ZSTR_LEN(ctx->tag.s))) {
     457             :                         ctx->tag_type = TAG_FORM;
     458             :                 } else {
     459             :                         ctx->tag_type = TAG_NORMAL;
     460             :                 }
     461             :         }
     462             :         STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
     463             : }
     464             : 
     465             : static inline void handle_arg(STD_PARA)
     466             : {
     467             :         if (ctx->arg.s) {
     468             :                 ZSTR_LEN(ctx->arg.s) = 0;
     469             :         }
     470             :         smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
     471             :         if (ctx->tag_type == TAG_FORM &&
     472             :                 strncasecmp(ZSTR_VAL(ctx->arg.s), "action", ZSTR_LEN(ctx->arg.s)) == 0) {
     473             :                 ctx->attr_type = ATTR_ACTION;
     474             :         } else {
     475             :                 ctx->attr_type = ATTR_NORMAL;
     476             :         }
     477             : }
     478             : 
     479             : static inline void handle_val(STD_PARA, char quotes, char type)
     480             : {
     481             :         smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
     482             :         if (ctx->tag_type == TAG_FORM && ctx->attr_type == ATTR_ACTION) {
     483             :                 smart_str_setl(&ctx->attr_val, start + quotes, YYCURSOR - start - quotes * 2);
     484             :         }
     485             :         tag_arg(ctx, quotes, type);
     486             : }
     487             : 
     488             : static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen)
     489             : {
     490             :         char *end, *q;
     491             :         char *xp;
     492             :         char *start;
     493             :         size_t rest;
     494             : 
     495             :         smart_str_appendl(&ctx->buf, newdata, newlen);
     496             : 
     497             :         YYCURSOR = ZSTR_VAL(ctx->buf.s);
     498             :         YYLIMIT = ZSTR_VAL(ctx->buf.s) + ZSTR_LEN(ctx->buf.s);
     499             : 
     500             :         switch (STATE) {
     501             :                 case STATE_PLAIN: goto state_plain;
     502             :                 case STATE_TAG: goto state_tag;
     503             :                 case STATE_NEXT_ARG: goto state_next_arg;
     504             :                 case STATE_ARG: goto state_arg;
     505             :                 case STATE_BEFORE_VAL: goto state_before_val;
     506             :                 case STATE_VAL: goto state_val;
     507             :         }
     508             : 
     509             : 
     510             : state_plain_begin:
     511             :         STATE = STATE_PLAIN;
     512             : 
     513             : state_plain:
     514             :         start = YYCURSOR;
     515             : 
     516             : #line 517 "ext/standard/url_scanner_ex.c"
     517             : {
     518             :         YYCTYPE yych;
     519             :         static const unsigned char yybm[] = {
     520             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     521             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     522             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     523             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     524             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     525             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     526             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     527             :                 128, 128, 128, 128,   0, 128, 128, 128, 
     528             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     529             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     530             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     531             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     532             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     533             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     534             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     535             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     536             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     537             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     538             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     539             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     540             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     541             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     542             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     543             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     544             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     545             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     546             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     547             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     548             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     549             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     550             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     551             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     552             :         };
     553             : 
     554        1831 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
     555        1829 :         yych = *YYCURSOR;
     556        1829 :         if (yybm[0+yych] & 128) {
     557         915 :                 goto yy4;
     558             :         }
     559         914 :         ++YYCURSOR;
     560             : #line 519 "ext/standard/url_scanner_ex.re"
     561             :         { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
     562             : #line 563 "ext/standard/url_scanner_ex.c"
     563             : yy4:
     564        4881 :         ++YYCURSOR;
     565        4881 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
     566        4857 :         yych = *YYCURSOR;
     567        4857 :         if (yybm[0+yych] & 128) {
     568        3966 :                 goto yy4;
     569             :         }
     570             : #line 520 "ext/standard/url_scanner_ex.re"
     571             :         { passthru(STD_ARGS); goto state_plain; }
     572             : #line 573 "ext/standard/url_scanner_ex.c"
     573             : }
     574             : #line 521 "ext/standard/url_scanner_ex.re"
     575             : 
     576             : 
     577             : state_tag:
     578             :         start = YYCURSOR;
     579             : 
     580             : #line 581 "ext/standard/url_scanner_ex.c"
     581             : {
     582             :         YYCTYPE yych;
     583             :         static const unsigned char yybm[] = {
     584             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     585             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     586             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     587             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     588             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     589             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     590             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     591             :                   0,   0, 128,   0,   0,   0,   0,   0, 
     592             :                   0, 128, 128, 128, 128, 128, 128, 128, 
     593             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     594             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     595             :                 128, 128, 128,   0,   0,   0,   0,   0, 
     596             :                   0, 128, 128, 128, 128, 128, 128, 128, 
     597             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     598             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     599             :                 128, 128, 128,   0,   0,   0,   0,   0, 
     600             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     601             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     602             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     603             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     604             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     605             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     606             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     607             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     608             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     609             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     610             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     611             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     612             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     613             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     614             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     615             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     616             :         };
     617         914 :         if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
     618         914 :         yych = *YYCURSOR;
     619         914 :         if (yych <= '@') {
     620         424 :                 if (yych != ':') goto yy11;
     621             :         } else {
     622         490 :                 if (yych <= 'Z') goto yy9;
     623         490 :                 if (yych <= '`') goto yy11;
     624         490 :                 if (yych >= '{') goto yy11;
     625             :         }
     626             : yy9:
     627         490 :         ++YYCURSOR;
     628         490 :         yych = *YYCURSOR;
     629         490 :         goto yy14;
     630             : yy10:
     631             : #line 526 "ext/standard/url_scanner_ex.re"
     632             :         { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
     633             : #line 634 "ext/standard/url_scanner_ex.c"
     634             : yy11:
     635         424 :         ++YYCURSOR;
     636             : #line 527 "ext/standard/url_scanner_ex.re"
     637             :         { passthru(STD_ARGS); goto state_plain_begin; }
     638             : #line 639 "ext/standard/url_scanner_ex.c"
     639             : yy13:
     640         599 :         ++YYCURSOR;
     641         599 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
     642         599 :         yych = *YYCURSOR;
     643             : yy14:
     644        1089 :         if (yybm[0+yych] & 128) {
     645         599 :                 goto yy13;
     646             :         }
     647         490 :         goto yy10;
     648             : }
     649             : #line 528 "ext/standard/url_scanner_ex.re"
     650             : 
     651             : 
     652             : state_next_arg_begin:
     653             :         STATE = STATE_NEXT_ARG;
     654             : 
     655             : state_next_arg:
     656             :         start = YYCURSOR;
     657             : 
     658             : #line 659 "ext/standard/url_scanner_ex.c"
     659             : {
     660             :         YYCTYPE yych;
     661             :         static const unsigned char yybm[] = {
     662             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     663             :                   0, 128, 128, 128,   0, 128,   0,   0, 
     664             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     665             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     666             :                 128,   0,   0,   0,   0,   0,   0,   0, 
     667             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     668             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     669             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     670             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     671             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     672             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     673             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     674             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     675             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     676             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     677             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     678             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     679             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     680             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     681             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     682             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     683             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     684             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     685             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     686             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     687             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     688             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     689             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     690             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     691             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     692             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     693             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     694             :         };
     695        1479 :         if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
     696        1479 :         yych = *YYCURSOR;
     697        1479 :         if (yych <= '.') {
     698         527 :                 if (yych <= '\f') {
     699           0 :                         if (yych <= 0x08) goto yy25;
     700           0 :                         if (yych <= '\v') goto yy21;
     701           0 :                         goto yy25;
     702             :                 } else {
     703         527 :                         if (yych <= '\r') goto yy21;
     704         526 :                         if (yych == ' ') goto yy21;
     705           0 :                         goto yy25;
     706             :                 }
     707             :         } else {
     708         952 :                 if (yych <= '@') {
     709         427 :                         if (yych <= '/') goto yy17;
     710         422 :                         if (yych == '>') goto yy19;
     711           0 :                         goto yy25;
     712             :                 } else {
     713         525 :                         if (yych <= 'Z') goto yy23;
     714         525 :                         if (yych <= '`') goto yy25;
     715         525 :                         if (yych <= 'z') goto yy23;
     716           0 :                         goto yy25;
     717             :                 }
     718             :         }
     719             : yy17:
     720           5 :         ++YYCURSOR;
     721           5 :         if ((yych = *YYCURSOR) == '>') goto yy28;
     722             : yy18:
     723             : #line 539 "ext/standard/url_scanner_ex.re"
     724             :         { passthru(STD_ARGS); goto state_plain_begin; }
     725             : #line 726 "ext/standard/url_scanner_ex.c"
     726             : yy19:
     727         422 :         ++YYCURSOR;
     728             : yy20:
     729             : #line 536 "ext/standard/url_scanner_ex.re"
     730             :         { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
     731             : #line 732 "ext/standard/url_scanner_ex.c"
     732             : yy21:
     733         527 :         ++YYCURSOR;
     734         527 :         yych = *YYCURSOR;
     735         527 :         goto yy27;
     736             : yy22:
     737             : #line 537 "ext/standard/url_scanner_ex.re"
     738             :         { passthru(STD_ARGS); goto state_next_arg; }
     739             : #line 740 "ext/standard/url_scanner_ex.c"
     740             : yy23:
     741         525 :         ++YYCURSOR;
     742             : #line 538 "ext/standard/url_scanner_ex.re"
     743             :         { --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
     744             : #line 745 "ext/standard/url_scanner_ex.c"
     745             : yy25:
     746           0 :         yych = *++YYCURSOR;
     747           0 :         goto yy18;
     748             : yy26:
     749           8 :         ++YYCURSOR;
     750           8 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
     751           8 :         yych = *YYCURSOR;
     752             : yy27:
     753         535 :         if (yybm[0+yych] & 128) {
     754           8 :                 goto yy26;
     755             :         }
     756         527 :         goto yy22;
     757             : yy28:
     758           5 :         ++YYCURSOR;
     759           5 :         yych = *YYCURSOR;
     760           5 :         goto yy20;
     761             : }
     762             : #line 540 "ext/standard/url_scanner_ex.re"
     763             : 
     764             : 
     765             : state_arg:
     766             :         start = YYCURSOR;
     767             : 
     768             : #line 769 "ext/standard/url_scanner_ex.c"
     769             : {
     770             :         YYCTYPE yych;
     771             :         static const unsigned char yybm[] = {
     772             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     773             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     774             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     775             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     776             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     777             :                   0,   0,   0,   0,   0, 128,   0,   0, 
     778             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     779             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     780             :                   0, 128, 128, 128, 128, 128, 128, 128, 
     781             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     782             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     783             :                 128, 128, 128,   0,   0,   0,   0,   0, 
     784             :                   0, 128, 128, 128, 128, 128, 128, 128, 
     785             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     786             :                 128, 128, 128, 128, 128, 128, 128, 128, 
     787             :                 128, 128, 128,   0,   0,   0,   0,   0, 
     788             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     789             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     790             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     791             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     792             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     793             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     794             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     795             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     796             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     797             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     798             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     799             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     800             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     801             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     802             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     803             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     804             :         };
     805         525 :         if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
     806         525 :         yych = *YYCURSOR;
     807         525 :         if (yych <= '@') goto yy33;
     808         525 :         if (yych <= 'Z') goto yy31;
     809         525 :         if (yych <= '`') goto yy33;
     810         525 :         if (yych >= '{') goto yy33;
     811             : yy31:
     812         525 :         ++YYCURSOR;
     813         525 :         yych = *YYCURSOR;
     814         525 :         goto yy36;
     815             : yy32:
     816             : #line 545 "ext/standard/url_scanner_ex.re"
     817             :         { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
     818             : #line 819 "ext/standard/url_scanner_ex.c"
     819             : yy33:
     820           0 :         ++YYCURSOR;
     821             : #line 546 "ext/standard/url_scanner_ex.re"
     822             :         { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
     823             : #line 824 "ext/standard/url_scanner_ex.c"
     824             : yy35:
     825        2007 :         ++YYCURSOR;
     826        2007 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
     827        2007 :         yych = *YYCURSOR;
     828             : yy36:
     829        2532 :         if (yybm[0+yych] & 128) {
     830        2007 :                 goto yy35;
     831             :         }
     832         525 :         goto yy32;
     833             : }
     834             : #line 547 "ext/standard/url_scanner_ex.re"
     835             : 
     836             : 
     837             : state_before_val:
     838             :         start = YYCURSOR;
     839             : 
     840             : #line 841 "ext/standard/url_scanner_ex.c"
     841             : {
     842             :         YYCTYPE yych;
     843             :         static const unsigned char yybm[] = {
     844             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     845             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     846             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     847             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     848             :                 128,   0,   0,   0,   0,   0,   0,   0, 
     849             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     850             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     851             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     852             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     853             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     854             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     855             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     856             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     857             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     858             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     859             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     860             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     861             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     862             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     863             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     864             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     865             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     866             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     867             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     868             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     869             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     870             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     871             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     872             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     873             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     874             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     875             :                   0,   0,   0,   0,   0,   0,   0,   0, 
     876             :         };
     877         525 :         if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
     878         525 :         yych = *YYCURSOR;
     879         525 :         if (yych == ' ') goto yy39;
     880         525 :         if (yych == '=') goto yy41;
     881           0 :         goto yy43;
     882             : yy39:
     883           0 :         yych = *(YYMARKER = ++YYCURSOR);
     884           0 :         if (yych == ' ') goto yy46;
     885           0 :         if (yych == '=') goto yy44;
     886             : yy40:
     887             : #line 553 "ext/standard/url_scanner_ex.re"
     888             :         { --YYCURSOR; goto state_next_arg_begin; }
     889             : #line 890 "ext/standard/url_scanner_ex.c"
     890             : yy41:
     891         525 :         ++YYCURSOR;
     892         525 :         yych = *YYCURSOR;
     893         525 :         goto yy45;
     894             : yy42:
     895             : #line 552 "ext/standard/url_scanner_ex.re"
     896             :         { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
     897             : #line 898 "ext/standard/url_scanner_ex.c"
     898             : yy43:
     899           0 :         yych = *++YYCURSOR;
     900           0 :         goto yy40;
     901             : yy44:
     902           0 :         ++YYCURSOR;
     903           0 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
     904           0 :         yych = *YYCURSOR;
     905             : yy45:
     906         525 :         if (yybm[0+yych] & 128) {
     907           0 :                 goto yy44;
     908             :         }
     909         525 :         goto yy42;
     910             : yy46:
     911           0 :         ++YYCURSOR;
     912           0 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
     913           0 :         yych = *YYCURSOR;
     914           0 :         if (yych == ' ') goto yy46;
     915           0 :         if (yych == '=') goto yy44;
     916           0 :         YYCURSOR = YYMARKER;
     917           0 :         goto yy40;
     918             : }
     919             : #line 554 "ext/standard/url_scanner_ex.re"
     920             : 
     921             : 
     922             : 
     923             : state_val:
     924             :         start = YYCURSOR;
     925             : 
     926             : #line 927 "ext/standard/url_scanner_ex.c"
     927             : {
     928             :         YYCTYPE yych;
     929             :         static const unsigned char yybm[] = {
     930             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     931             :                 224, 192, 192, 224, 224, 192, 224, 224, 
     932             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     933             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     934             :                 192, 224,  64, 224, 224, 224, 224, 128, 
     935             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     936             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     937             :                 224, 224, 224, 224, 224, 224,   0, 224, 
     938             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     939             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     940             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     941             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     942             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     943             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     944             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     945             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     946             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     947             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     948             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     949             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     950             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     951             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     952             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     953             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     954             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     955             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     956             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     957             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     958             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     959             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     960             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     961             :                 224, 224, 224, 224, 224, 224, 224, 224, 
     962             :         };
     963         525 :         if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
     964         525 :         yych = *YYCURSOR;
     965         525 :         if (yych <= ' ') {
     966           0 :                 if (yych <= '\f') {
     967           0 :                         if (yych <= 0x08) goto yy54;
     968           0 :                         if (yych <= '\n') goto yy56;
     969           0 :                         goto yy54;
     970             :                 } else {
     971           0 :                         if (yych <= '\r') goto yy56;
     972           0 :                         if (yych <= 0x1F) goto yy54;
     973           0 :                         goto yy56;
     974             :                 }
     975             :         } else {
     976         525 :                 if (yych <= '&') {
     977         517 :                         if (yych != '"') goto yy54;
     978             :                 } else {
     979           8 :                         if (yych <= '\'') goto yy53;
     980           5 :                         if (yych == '>') goto yy56;
     981           5 :                         goto yy54;
     982             :                 }
     983             :         }
     984         517 :         yych = *(YYMARKER = ++YYCURSOR);
     985         517 :         if (yych != '>') goto yy65;
     986             : yy52:
     987             : #line 563 "ext/standard/url_scanner_ex.re"
     988             :         { passthru(STD_ARGS); goto state_next_arg_begin; }
     989             : #line 990 "ext/standard/url_scanner_ex.c"
     990             : yy53:
     991           3 :         yych = *(YYMARKER = ++YYCURSOR);
     992           3 :         if (yych == '>') goto yy52;
     993           3 :         goto yy60;
     994             : yy54:
     995           5 :         ++YYCURSOR;
     996           5 :         yych = *YYCURSOR;
     997           5 :         goto yy58;
     998             : yy55:
     999             : #line 562 "ext/standard/url_scanner_ex.re"
    1000             :         { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
    1001             : #line 1002 "ext/standard/url_scanner_ex.c"
    1002             : yy56:
    1003           0 :         yych = *++YYCURSOR;
    1004           0 :         goto yy52;
    1005             : yy57:
    1006          18 :         ++YYCURSOR;
    1007          18 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
    1008          18 :         yych = *YYCURSOR;
    1009             : yy58:
    1010          23 :         if (yybm[0+yych] & 32) {
    1011          18 :                 goto yy57;
    1012             :         }
    1013           5 :         goto yy55;
    1014             : yy59:
    1015          19 :         ++YYCURSOR;
    1016          19 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
    1017          19 :         yych = *YYCURSOR;
    1018             : yy60:
    1019          22 :         if (yybm[0+yych] & 64) {
    1020          19 :                 goto yy59;
    1021             :         }
    1022           3 :         if (yych <= '=') goto yy62;
    1023             : yy61:
    1024           0 :         YYCURSOR = YYMARKER;
    1025           0 :         goto yy52;
    1026             : yy62:
    1027           3 :         ++YYCURSOR;
    1028             : #line 561 "ext/standard/url_scanner_ex.re"
    1029             :         { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
    1030             : #line 1031 "ext/standard/url_scanner_ex.c"
    1031             : yy64:
    1032        8333 :         ++YYCURSOR;
    1033        8333 :         if (YYLIMIT <= YYCURSOR) YYFILL(1);
    1034        8333 :         yych = *YYCURSOR;
    1035             : yy65:
    1036        8850 :         if (yybm[0+yych] & 128) {
    1037        8333 :                 goto yy64;
    1038             :         }
    1039         517 :         if (yych >= '>') goto yy61;
    1040         517 :         ++YYCURSOR;
    1041             : #line 560 "ext/standard/url_scanner_ex.re"
    1042             :         { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
    1043             : #line 1044 "ext/standard/url_scanner_ex.c"
    1044             : }
    1045             : #line 564 "ext/standard/url_scanner_ex.re"
    1046             : 
    1047             : 
    1048             : stop:
    1049             :         if (YYLIMIT < start) {
    1050             :                 /* XXX: Crash avoidance. Need to work with reporter to figure out what goes wrong */
    1051             :                 rest = 0;
    1052             :         } else {
    1053             :                 rest = YYLIMIT - start;
    1054             :                 scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR, rest));
    1055             :         }
    1056             : 
    1057             :         if (rest) memmove(ZSTR_VAL(ctx->buf.s), start, rest);
    1058             :         ZSTR_LEN(ctx->buf.s) = rest;
    1059             : }
    1060             : 
    1061             : 
    1062             : PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen, int encode)
    1063             : {
    1064             :         char *result;
    1065             :         smart_str surl = {0};
    1066             :         smart_str buf = {0};
    1067             :         smart_str url_app = {0};
    1068             :         zend_string *encoded;
    1069             : 
    1070             :         smart_str_appendl(&surl, url, urllen);
    1071             : 
    1072             :         if (encode) {
    1073             :                 encoded = php_raw_url_encode(name, strlen(name));
    1074             :                 smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
    1075             :                 zend_string_free(encoded);
    1076             :         } else {
    1077             :                 smart_str_appends(&url_app, name);
    1078             :         }
    1079             :         smart_str_appendc(&url_app, '=');
    1080             :         if (encode) {
    1081             :                 encoded = php_raw_url_encode(value, strlen(value));
    1082             :                 smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
    1083             :                 zend_string_free(encoded);
    1084             :         } else {
    1085             :                 smart_str_appends(&url_app, value);
    1086             :         }
    1087             : 
    1088             :         append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output);
    1089             : 
    1090             :         smart_str_0(&buf);
    1091             :         if (newlen) *newlen = ZSTR_LEN(buf.s);
    1092             :         result = estrndup(ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
    1093             : 
    1094             :         smart_str_free(&url_app);
    1095             :         smart_str_free(&buf);
    1096             : 
    1097             :         return result;
    1098             : }
    1099             : 
    1100             : 
    1101             : static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_bool do_flush, url_adapt_state_ex_t *ctx)
    1102             : {
    1103             :         char *retval;
    1104             : 
    1105             :         xx_mainloop(ctx, src, srclen);
    1106             : 
    1107             :         if (!ctx->result.s) {
    1108             :                 smart_str_appendl(&ctx->result, "", 0);
    1109             :                 *newlen = 0;
    1110             :         } else {
    1111             :                 *newlen = ZSTR_LEN(ctx->result.s);
    1112             :         }
    1113             :         smart_str_0(&ctx->result);
    1114             :         if (do_flush) {
    1115             :                 smart_str_append(&ctx->result, ctx->buf.s);
    1116             :                 *newlen += ZSTR_LEN(ctx->buf.s);
    1117             :                 smart_str_free(&ctx->buf);
    1118             :                 smart_str_free(&ctx->val);
    1119             :                 smart_str_free(&ctx->attr_val);
    1120             :         }
    1121             :         retval = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s));
    1122             :         smart_str_free(&ctx->result);
    1123             :         return retval;
    1124             : }
    1125             : 
    1126             : static int php_url_scanner_ex_activate(int type)
    1127             : {
    1128             :         url_adapt_state_ex_t *ctx;
    1129             : 
    1130             :         if (type) {
    1131             :                 ctx = &BG(url_adapt_session_ex);
    1132             :         } else {
    1133             :                 ctx = &BG(url_adapt_output_ex);
    1134             :         }
    1135             : 
    1136             :         memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags));
    1137             : 
    1138             :         return SUCCESS;
    1139             : }
    1140             : 
    1141             : static int php_url_scanner_ex_deactivate(int type)
    1142             : {
    1143             :         url_adapt_state_ex_t *ctx;
    1144             : 
    1145             :         if (type) {
    1146             :                 ctx = &BG(url_adapt_session_ex);
    1147             :         } else {
    1148             :                 ctx = &BG(url_adapt_output_ex);
    1149             :         }
    1150             : 
    1151             :         smart_str_free(&ctx->result);
    1152             :         smart_str_free(&ctx->buf);
    1153             :         smart_str_free(&ctx->tag);
    1154             :         smart_str_free(&ctx->arg);
    1155             :         smart_str_free(&ctx->attr_val);
    1156             : 
    1157             :         return SUCCESS;
    1158             : }
    1159             : 
    1160             : static inline void php_url_scanner_session_handler_impl(char *output, size_t output_len, char **handled_output, size_t *handled_output_len, int mode, int type)
    1161             : {
    1162             :         size_t len;
    1163             :         url_adapt_state_ex_t *url_state;
    1164             : 
    1165             :         if (type) {
    1166             :                 url_state = &BG(url_adapt_session_ex);
    1167             :         } else {
    1168             :                 url_state = &BG(url_adapt_output_ex);
    1169             :         }
    1170             : 
    1171             :         if (ZSTR_LEN(url_state->url_app.s) != 0) {
    1172             :                 *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0), url_state);
    1173             :                 if (sizeof(uint) < sizeof(size_t)) {
    1174             :                         if (len > UINT_MAX)
    1175             :                                 len = UINT_MAX;
    1176             :                 }
    1177             :                 *handled_output_len = len;
    1178             :         } else if (ZSTR_LEN(url_state->url_app.s) == 0) {
    1179             :                 url_adapt_state_ex_t *ctx = url_state;
    1180             :                 if (ctx->buf.s && ZSTR_LEN(ctx->buf.s)) {
    1181             :                         smart_str_append(&ctx->result, ctx->buf.s);
    1182             :                         smart_str_appendl(&ctx->result, output, output_len);
    1183             : 
    1184             :                         *handled_output = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s));
    1185             :                         *handled_output_len = ZSTR_LEN(ctx->buf.s) + output_len;
    1186             : 
    1187             :                         smart_str_free(&ctx->buf);
    1188             :                         smart_str_free(&ctx->result);
    1189             :                 } else {
    1190             :                         *handled_output = estrndup(output, *handled_output_len = output_len);
    1191             :                 }
    1192             :         } else {
    1193             :                 *handled_output = NULL;
    1194             :         }
    1195             : }
    1196             : 
    1197             : static void php_url_scanner_session_handler(char *output, size_t output_len, char **handled_output, size_t *handled_output_len, int mode)
    1198             : {
    1199             :         php_url_scanner_session_handler_impl(output, output_len, handled_output, handled_output_len, mode, 1);
    1200             : }
    1201             : 
    1202             : static void php_url_scanner_output_handler(char *output, size_t output_len, char **handled_output, size_t *handled_output_len, int mode)
    1203             : {
    1204             :         php_url_scanner_session_handler_impl(output, output_len, handled_output, handled_output_len, mode, 0);
    1205             : }
    1206             : 
    1207             : static inline int php_url_scanner_add_var_impl(char *name, size_t name_len, char *value, size_t value_len, int encode, int type)
    1208             : {
    1209             :         smart_str sname = {0};
    1210             :         smart_str svalue = {0};
    1211             :         smart_str hname = {0};
    1212             :         smart_str hvalue = {0};
    1213             :         zend_string *encoded;
    1214             :         url_adapt_state_ex_t *url_state;
    1215             :         php_output_handler_func_t handler;
    1216             : 
    1217             :         if (type) {
    1218             :                 url_state = &BG(url_adapt_session_ex);
    1219             :                 handler = php_url_scanner_session_handler;
    1220             :         } else {
    1221             :                 url_state = &BG(url_adapt_output_ex);
    1222             :                 handler = php_url_scanner_output_handler;
    1223             :         }
    1224             : 
    1225             :         if (!url_state->active) {
    1226             :                 php_url_scanner_ex_activate(type);
    1227             :                 php_output_start_internal(ZEND_STRL("URL-Rewriter"), handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS);
    1228             :                 url_state->active = 1;
    1229             :         }
    1230             : 
    1231             :         if (url_state->url_app.s && ZSTR_LEN(url_state->url_app.s) != 0) {
    1232             :                 smart_str_appends(&url_state->url_app, PG(arg_separator).output);
    1233             :         }
    1234             : 
    1235             :         if (encode) {
    1236             :                 encoded = php_raw_url_encode(name, name_len);
    1237             :                 smart_str_appendl(&sname, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); zend_string_free(encoded);
    1238             :                 encoded = php_raw_url_encode(value, value_len);
    1239             :                 smart_str_appendl(&svalue, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); zend_string_free(encoded);
    1240             :                 encoded = php_escape_html_entities_ex((unsigned char*)name, name_len, 0, ENT_QUOTES|ENT_SUBSTITUTE, SG(default_charset), 0);
    1241             :                 smart_str_appendl(&hname, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); zend_string_free(encoded);
    1242             :                 encoded = php_escape_html_entities_ex((unsigned char*)value, value_len, 0, ENT_QUOTES|ENT_SUBSTITUTE, SG(default_charset), 0);
    1243             :                 smart_str_appendl(&hvalue, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); zend_string_free(encoded);
    1244             :         } else {
    1245             :                 smart_str_appendl(&sname, name, name_len);
    1246             :                 smart_str_appendl(&svalue, value, value_len);
    1247             :                 smart_str_appendl(&hname, name, name_len);
    1248             :                 smart_str_appendl(&hvalue, value, value_len);
    1249             :         }
    1250             : 
    1251             :         smart_str_append_smart_str(&url_state->url_app, &sname);
    1252             :         smart_str_appendc(&url_state->url_app, '=');
    1253             :         smart_str_append_smart_str(&url_state->url_app, &svalue);
    1254             : 
    1255             :         smart_str_appends(&url_state->form_app, "<input type=\"hidden\" name=\"");
    1256             :         smart_str_append_smart_str(&url_state->form_app, &hname);
    1257             :         smart_str_appends(&url_state->form_app, "\" value=\"");
    1258             :         smart_str_append_smart_str(&url_state->form_app, &hvalue);
    1259             :         smart_str_appends(&url_state->form_app, "\" />");
    1260             : 
    1261             :         smart_str_free(&sname);
    1262             :         smart_str_free(&svalue);
    1263             :         smart_str_free(&hname);
    1264             :         smart_str_free(&hvalue);
    1265             : 
    1266             :         return SUCCESS;
    1267             : }
    1268             : 
    1269             : 
    1270             : PHPAPI int php_url_scanner_add_session_var(char *name, size_t name_len, char *value, size_t value_len, int encode)
    1271             : {
    1272             :         return php_url_scanner_add_var_impl(name, name_len, value, value_len, encode, 1);
    1273             : }
    1274             : 
    1275             : 
    1276             : PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, size_t value_len, int encode)
    1277             : {
    1278             :         return php_url_scanner_add_var_impl(name, name_len, value, value_len, encode, 0);
    1279             : }
    1280             : 
    1281             : 
    1282             : static inline void php_url_scanner_reset_vars_impl(int type) {
    1283             :         url_adapt_state_ex_t *url_state;
    1284             : 
    1285             :         if (type) {
    1286             :                 url_state = &BG(url_adapt_session_ex);
    1287             :         } else {
    1288             :                 url_state = &BG(url_adapt_output_ex);
    1289             :         }
    1290             : 
    1291             :         if (url_state->form_app.s) {
    1292             :                 ZSTR_LEN(url_state->form_app.s) = 0;
    1293             :         }
    1294             :         if (url_state->url_app.s) {
    1295             :                 ZSTR_LEN(url_state->url_app.s) = 0;
    1296             :         }
    1297             : }
    1298             : 
    1299             : 
    1300             : PHPAPI int php_url_scanner_reset_session_vars(void)
    1301             : {
    1302             :         php_url_scanner_reset_vars_impl(1);
    1303             :         return SUCCESS;
    1304             : }
    1305             : 
    1306             : 
    1307             : PHPAPI int php_url_scanner_reset_vars(void)
    1308             : {
    1309             :         php_url_scanner_reset_vars_impl(0);
    1310             :         return SUCCESS;
    1311             : }
    1312             : 
    1313             : 
    1314             : static inline int php_url_scanner_reset_var_impl(zend_string *name, int encode, int type)
    1315             : {
    1316             :         char *start, *end, *limit;
    1317             :         size_t separator_len;
    1318             :         smart_str sname = {0};
    1319             :         smart_str hname = {0};
    1320             :         smart_str url_app = {0};
    1321             :         smart_str form_app = {0};
    1322             :         zend_string *encoded;
    1323             :         int ret = SUCCESS;
    1324             :         zend_bool sep_removed = 0;
    1325             :         url_adapt_state_ex_t *url_state;
    1326             : 
    1327             :         if (type) {
    1328             :                 url_state = &BG(url_adapt_session_ex);
    1329             :         } else {
    1330             :                 url_state = &BG(url_adapt_output_ex);
    1331             :         }
    1332             : 
    1333             :         /* Short circuit check. Only check url_app. */
    1334             :         if (!url_state->url_app.s || !ZSTR_LEN(url_state->url_app.s)) {
    1335             :                 return SUCCESS;
    1336             :         }
    1337             : 
    1338             :         if (encode) {
    1339             :                 encoded = php_raw_url_encode(ZSTR_VAL(name), ZSTR_LEN(name));
    1340             :                 smart_str_appendl(&sname, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
    1341             :                 zend_string_free(encoded);
    1342             :                 encoded = php_escape_html_entities_ex((unsigned char *)ZSTR_VAL(name), ZSTR_LEN(name), 0, ENT_QUOTES|ENT_SUBSTITUTE, SG(default_charset), 0);
    1343             :                 smart_str_appendl(&hname, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
    1344             :                 zend_string_free(encoded);
    1345             :         } else {
    1346             :                 smart_str_appendl(&sname, ZSTR_VAL(name), ZSTR_LEN(name));
    1347             :                 smart_str_appendl(&hname, ZSTR_VAL(name), ZSTR_LEN(name));
    1348             :         }
    1349             :         smart_str_0(&sname);
    1350             :         smart_str_0(&hname);
    1351             : 
    1352             :         smart_str_append_smart_str(&url_app, &sname);
    1353             :         smart_str_appendc(&url_app, '=');
    1354             :         smart_str_0(&url_app);
    1355             : 
    1356             :         smart_str_appends(&form_app, "<input type=\"hidden\" name=\"");
    1357             :         smart_str_append_smart_str(&form_app, &hname);
    1358             :         smart_str_appends(&form_app, "\" value=\"");
    1359             :         smart_str_0(&form_app);
    1360             : 
    1361             :         /* Short circuit check. Only check url_app. */
    1362             :         start = (char *) php_memnstr(ZSTR_VAL(url_state->url_app.s),
    1363             :                                                                  ZSTR_VAL(url_app.s), ZSTR_LEN(url_app.s),
    1364             :                                                                  ZSTR_VAL(url_state->url_app.s) + ZSTR_LEN(url_state->url_app.s));
    1365             :         if (!start) {
    1366             :                 ret = FAILURE;
    1367             :                 goto finish;
    1368             :         }
    1369             : 
    1370             :         /* Get end of url var */
    1371             :         limit = ZSTR_VAL(url_state->url_app.s) + ZSTR_LEN(url_state->url_app.s);
    1372             :         end = start + ZSTR_LEN(url_app.s);
    1373             :         separator_len = strlen(PG(arg_separator).output);
    1374             :         while (end < limit) {
    1375             :                 if (!memcmp(end, PG(arg_separator).output, separator_len)) {
    1376             :                         end += separator_len;
    1377             :                         sep_removed = 1;
    1378             :                         break;
    1379             :                 }
    1380             :                 end++;
    1381             :         }
    1382             :         /* Remove all when this is the only rewrite var */
    1383             :         if (ZSTR_LEN(url_state->url_app.s) == end - start) {
    1384             :                 php_url_scanner_reset_vars_impl(type);
    1385             :                 goto finish;
    1386             :         }
    1387             :         /* Check preceeding separator */
    1388             :         if (!sep_removed
    1389             :                 && start - PG(arg_separator).output >= separator_len
    1390             :                 && !memcmp(start - separator_len, PG(arg_separator).output, separator_len)) {
    1391             :                 start -= separator_len;
    1392             :         }
    1393             :         /* Remove partially */
    1394             :         memmove(start, end,
    1395             :                         ZSTR_LEN(url_state->url_app.s) - (end - ZSTR_VAL(url_state->url_app.s)));
    1396             :         ZSTR_LEN(url_state->url_app.s) -= end - start;
    1397             :         ZSTR_VAL(url_state->url_app.s)[ZSTR_LEN(url_state->url_app.s)] = '\0';
    1398             : 
    1399             :         /* Remove form var */
    1400             :         start = (char *) php_memnstr(ZSTR_VAL(url_state->form_app.s),
    1401             :                                                 ZSTR_VAL(form_app.s), ZSTR_LEN(form_app.s),
    1402             :                                                 ZSTR_VAL(url_state->form_app.s) + ZSTR_LEN(url_state->form_app.s));
    1403             :         if (!start) {
    1404             :                 /* Should not happen */
    1405             :                 ret = FAILURE;
    1406             :                 php_url_scanner_reset_vars_impl(type);
    1407             :                 goto finish;
    1408             :         }
    1409             :         /* Get end of form var */
    1410             :         limit = ZSTR_VAL(url_state->form_app.s) + ZSTR_LEN(url_state->form_app.s);
    1411             :         end = start + ZSTR_LEN(form_app.s);
    1412             :         while (end < limit) {
    1413             :                 if (*end == '>') {
    1414             :                         end += 1;
    1415             :                         break;
    1416             :                 }
    1417             :                 end++;
    1418             :         }
    1419             :         /* Remove partially */
    1420             :         memmove(start, end,
    1421             :                         ZSTR_LEN(url_state->form_app.s) - (end - ZSTR_VAL(url_state->form_app.s)));
    1422             :         ZSTR_LEN(url_state->form_app.s) -= end - start;
    1423             :         ZSTR_VAL(url_state->form_app.s)[ZSTR_LEN(url_state->form_app.s)] = '\0';
    1424             : 
    1425             : finish:
    1426             :         smart_str_free(&url_app);
    1427             :         smart_str_free(&form_app);
    1428             :         smart_str_free(&sname);
    1429             :         smart_str_free(&hname);
    1430             :         return ret;
    1431             : }
    1432             : 
    1433             : 
    1434             : PHPAPI int php_url_scanner_reset_session_var(zend_string *name, int encode)
    1435             : {
    1436             :         return php_url_scanner_reset_var_impl(name, encode, 1);
    1437             : }
    1438             : 
    1439             : 
    1440             : PHPAPI int php_url_scanner_reset_var(zend_string *name, int encode)
    1441             : {
    1442             :         return php_url_scanner_reset_var_impl(name, encode, 0);
    1443             : }
    1444             : 
    1445             : 
    1446             : PHP_MINIT_FUNCTION(url_scanner)
    1447             : {
    1448             :         REGISTER_INI_ENTRIES();
    1449             :         return SUCCESS;
    1450             : }
    1451             : 
    1452             : PHP_MSHUTDOWN_FUNCTION(url_scanner)
    1453             : {
    1454             :         UNREGISTER_INI_ENTRIES();
    1455             : 
    1456             :         return SUCCESS;
    1457             : }
    1458             : 
    1459             : PHP_RINIT_FUNCTION(url_scanner)
    1460             : {
    1461             :         BG(url_adapt_session_ex).active    = 0;
    1462             :         BG(url_adapt_session_ex).tag_type  = 0;
    1463             :         BG(url_adapt_session_ex).attr_type = 0;
    1464             :         BG(url_adapt_output_ex).active    = 0;
    1465             :         BG(url_adapt_output_ex).tag_type  = 0;
    1466             :         BG(url_adapt_output_ex).attr_type = 0;
    1467             :         return SUCCESS;
    1468             : }
    1469             : 
    1470             : PHP_RSHUTDOWN_FUNCTION(url_scanner)
    1471             : {
    1472             :         if (BG(url_adapt_session_ex).active) {
    1473             :                 php_url_scanner_ex_deactivate(1);
    1474             :                 BG(url_adapt_session_ex).active    = 0;
    1475             :                 BG(url_adapt_session_ex).tag_type  = 0;
    1476             :                 BG(url_adapt_session_ex).attr_type = 0;
    1477             :         }
    1478             :         smart_str_free(&BG(url_adapt_session_ex).form_app);
    1479             :         smart_str_free(&BG(url_adapt_session_ex).url_app);
    1480             : 
    1481             :         if (BG(url_adapt_output_ex).active) {
    1482             :                 php_url_scanner_ex_deactivate(0);
    1483             :                 BG(url_adapt_output_ex).active    = 0;
    1484             :                 BG(url_adapt_output_ex).tag_type  = 0;
    1485             :                 BG(url_adapt_output_ex).attr_type = 0;
    1486             :         }
    1487             :         smart_str_free(&BG(url_adapt_output_ex).form_app);
    1488             :         smart_str_free(&BG(url_adapt_output_ex).url_app);
    1489             : 
    1490             :         return SUCCESS;
    1491             : }

Generated by: LCOV version 1.10

Generated at Tue, 27 Sep 2016 10:26:11 +0000 (4 days ago)

Copyright © 2005-2016 The PHP Group
All rights reserved.