/[jscoverage]/trunk/jscoverage-server.c
ViewVC logotype

Diff of /trunk/jscoverage-server.c

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

revision 475 by siliconforks, Sun Oct 4 06:05:17 2009 UTC revision 478 by siliconforks, Thu Oct 8 20:34:59 2009 UTC
# Line 801  Line 801 
801    
802    /* create a new exchange */    /* create a new exchange */
803    server_exchange = HTTPExchange_new(server_connection);    server_exchange = HTTPExchange_new(server_connection);
804    
805    HTTPExchange_set_method(server_exchange, HTTPExchange_get_method(client_exchange));    HTTPExchange_set_method(server_exchange, HTTPExchange_get_method(client_exchange));
806    HTTPExchange_set_request_uri(server_exchange, HTTPExchange_get_request_uri(client_exchange));  
807      /* don't send full URI to origin server - just send abs_path and query */
808      const char * query = HTTPExchange_get_query(client_exchange);
809      char * origin_server_request_uri;
810      if (query == NULL) {
811        origin_server_request_uri = xstrdup(abs_path);
812      }
813      else {
814        size_t abs_path_length = strlen(abs_path);
815        size_t query_length = strlen(query);
816        size_t origin_server_request_uri_length = addst(abs_path_length, query_length);
817        origin_server_request_uri_length = addst(origin_server_request_uri_length, 2);
818        origin_server_request_uri = xmalloc(origin_server_request_uri_length);
819        strcpy(origin_server_request_uri, abs_path);
820        origin_server_request_uri[abs_path_length] = '?';
821        strcpy(origin_server_request_uri + abs_path_length + 1, query);
822      }
823      HTTPExchange_set_request_uri(server_exchange, origin_server_request_uri);
824      free(origin_server_request_uri);
825    
826    for (const HTTPHeader * h = HTTPExchange_get_request_headers(client_exchange); h != NULL; h = h->next) {    for (const HTTPHeader * h = HTTPExchange_get_request_headers(client_exchange); h != NULL; h = h->next) {
827      if (strcasecmp(h->name, HTTP_TRAILER) == 0 || strcasecmp(h->name, HTTP_TRANSFER_ENCODING) == 0) {      if (strcasecmp(h->name, HTTP_TRAILER) == 0 || strcasecmp(h->name, HTTP_TRANSFER_ENCODING) == 0) {
828        /* do nothing: we want to keep this header */        /* do nothing: we want to keep this header */

Legend:
Removed from v.475  
changed lines
  Added in v.478

  ViewVC Help
Powered by ViewVC 1.1.24