kpdyer / fteproxy

programmable proxy for censorship circumvention
https://fteproxy.org/
Apache License 2.0
149 stars 21 forks source link

Use of custom formats doesn't seem to work #117

Closed oxtoacart closed 10 years ago

oxtoacart commented 10 years ago

If I try to run a client and server using a definitions file with custom format names like the below, and manually specify formats of "lantern-upstream" and "lantern-downstream" for the upstream and downstream formats respectively, the test simply hangs.

If I just change the format names back to the default ones and then run the client and server without specifying custom formats, the test succeeds (and in fact uses my custom formats).

Not a huge deal right now because I can work around it by just using the default format names.

19700101.json (bad)

{
  "lantern-downstream" : {
    "regex" : "^HTTP/1\\.1\\ 200 OK\\r\\nContent-Type:\\ ([0-9]+)\\r\\n\\r\\n\\C*$"
  },
  "lantern-upstream" : {
    "regex" : "^GET\\ \\/([0-9\\.\\/]*) HTTP/1\\.1\\r\\n\\r\\n$"
  }
}

19700101.json (good)

{
  "manual-http-response" : {
    "regex" : "^HTTP/1\\.1\\ 200 OK\\r\\nContent-Type:\\ ([0-9]+)\\r\\n\\r\\n\\C*$"
  },
  "manual-http-request" : {
    "regex" : "^GET\\ \\/([0-9\\.\\/]*) HTTP/1\\.1\\r\\n\\r\\n$"
  }
}
kpdyer commented 10 years ago

Try using

{
  "[my custom name]-response" : {
    "regex" : "[my custom regex]"
  },
  "[my custom name]-request" : {
    "regex" : "[my custom regex]"
  }
}

the key is that you need to use the suffixes request and response, and not upstream and downstream.

oxtoacart commented 10 years ago

Ah, yes, that worked, thanks!