Show
Ignore:
Timestamp:
01/05/11 22:13:13 (7 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1294265593 +0000
git-parent:

[bfbfefdddaf5536bb76ef394872ab8232ce3a957]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1294265593 +0000
Message:

stablize header order for my own sanity -- this is not a spec requirement, it just pisses me off a lot

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_http.c

    rbfbfefd ra22eaa7  
    10511051  return noit_http_response_append_bchain(ctx, n); 
    10521052} 
     1053static int casesort(const void *a, const void *b) { 
     1054  return strcasecmp(*((const char **)a), *((const char **)b)); 
     1055} 
    10531056static int 
    10541057_http_construct_leader(noit_http_session_ctx *ctx) { 
     
    10571060  const char *protocol_str; 
    10581061  const char *key, *value; 
    1059   int klen; 
     1062  int klen, i; 
     1063  const char **keys; 
    10601064  noit_hash_iter iter = NOIT_HASH_ITER_ZERO; 
    10611065 
     
    10841088  b->size += slen; \ 
    10851089} while(0) 
     1090  keys = alloca(sizeof(*keys)*ctx->res.headers.size); 
     1091  i = 0; 
    10861092  while(noit_hash_next_str(&ctx->res.headers, &iter, 
    10871093                           &key, &klen, &value)) { 
    1088     int vlen = strlen(value); 
     1094    keys[i++] = key; 
     1095  } 
     1096  qsort(keys, i, sizeof(*keys), casesort); 
     1097  for(i=0;i<ctx->res.headers.size;i++) { 
     1098    int vlen; 
     1099    key = keys[i]; 
     1100    klen = strlen(key); 
     1101    noit_hash_retr_str(&ctx->res.headers, key, klen, &value); 
     1102    vlen = strlen(value); 
    10891103    CTX_LEADER_APPEND(key, klen); 
    10901104    CTX_LEADER_APPEND(": ", 2);