Menu

Diff of /trunk/php-java-bridge/client.c [r406] .. [r407]  Maximize  Restore

Switch to unified view

a/trunk/php-java-bridge/client.c b/trunk/php-java-bridge/client.c
...
...
417
  case 'X':// Redirect
417
  case 'X':// Redirect
418
    {
418
    {
419
      char *key;
419
      char *key;
420
      static const char context[] = "X_JAVABRIDGE_CONTEXT";
420
      static const char context[] = "X_JAVABRIDGE_CONTEXT";
421
      static const char redirect[]= "X_JAVABRIDGE_REDIRECT";
421
      static const char redirect[]= "X_JAVABRIDGE_REDIRECT";
422
      if(!strcmp(str, redirect)) {
422
      if(!(*ctx)->peer_redirected && !strcmp(str, redirect)) {
423
        char *key = (char*)PARSER_GET_STRING(tag[1].strings, 0);
423
        char *key = (char*)PARSER_GET_STRING(tag[1].strings, 0);
424
        size_t key_len = tag[1].strings[0].length;
424
        size_t key_len = tag[1].strings[0].length;
425
        char *name = (*ctx)->server_name;
425
        char *name = (*ctx)->server_name;
426
        char *idx = strchr(name, ':');
426
        char *idx = strchr(name, ':');
427
        size_t len = idx ? idx-name : strlen(name);
427
        size_t len = idx ? idx-name : strlen(name);
...
...
486
  } else {
486
  } else {
487
    tail_call = 0;
487
    tail_call = 0;
488
  }
488
  }
489
  assert(zend_stack_is_empty(&ctx.containers));
489
  assert(zend_stack_is_empty(&ctx.containers));
490
  zend_stack_destroy(&ctx.containers);
490
  zend_stack_destroy(&ctx.containers);
491
491
  /* revert override redirect */
492
  /* revert override redirect */
492
  if((*env)->peer0!=-1) {
493
  if((*env)->peer0!=-1) {
493
    close((*env)->peer);
494
    close((*env)->peer);
494
    (*env)->peer = (*env)->peer0;
495
    (*env)->peer = (*env)->peer0;
495
    (*env)->f_recv = (*env)->f_recv0;
496
    (*env)->f_recv = (*env)->f_recv0;
496
    (*env)->peer0 = -1;
497
    (*env)->f_send = (*env)->f_send0;
497
  }
498
    (*env)->peer0 = -1;
499
  } else     /* Override redirect opens a secondary channel to the
500
              backend. Skip the following if an override redirect
501
              happened in the middle of redirect/reopen handling, i.e.
502
              between "begin redirect" above (must_reopen=2) or "begin
503
              reopen" (must_reopen=1) and "redirect finish" or "end
504
              reopen" (see must_reopen=0 in function end() and
505
              protocol_end() in protocol.c).  In other words: handle
506
              override redirect _or_ redirect for one packet, but not
507
              both. */
498
508
499
  /* re-open a closed HTTP connection */
509
  /* re-open a closed HTTP connection */
500
  if((*env)->must_reopen) {
510
  if((*env)->must_reopen) {
501
    char*server;
511
    char*server;
502
    if((*env)->must_reopen==2) { // redirect
512
    if((*env)->must_reopen==2) { // redirect