diff options
author | Andrey Uzunov <andrey.uzunov@gmail.com> | 2013-05-23 10:45:49 +0000 |
---|---|---|
committer | Andrey Uzunov <andrey.uzunov@gmail.com> | 2013-05-23 10:45:49 +0000 |
commit | eaf7c50a2d85c1f6cb1078955aa5a137dfcfc55a (patch) | |
tree | d8c501dbfa5812fa1651044b5b0bc5497a955104 | |
parent | 05d1a633b17b530fd95b20b11f08685d1c91a1ce (diff) | |
download | libmicrohttpd-eaf7c50a2d85c1f6cb1078955aa5a137dfcfc55a.tar.gz libmicrohttpd-eaf7c50a2d85c1f6cb1078955aa5a137dfcfc55a.zip |
spdy2http changes to use it as a forward proxy
-rw-r--r-- | src/spdy2http/proxy.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/spdy2http/proxy.c b/src/spdy2http/proxy.c index f1513680..018896ee 100644 --- a/src/spdy2http/proxy.c +++ b/src/spdy2http/proxy.c | |||
@@ -20,6 +20,10 @@ | |||
20 | * @file proxy.c | 20 | * @file proxy.c |
21 | * @brief Translates incoming SPDY requests to http server on localhost. | 21 | * @brief Translates incoming SPDY requests to http server on localhost. |
22 | * Uses libcurl. | 22 | * Uses libcurl. |
23 | * BUGS: | ||
24 | * Now the proxy works only when the HTTP server issues | ||
25 | * "Content-Length" header. Will brake on chunhed response. | ||
26 | * No error handling for curl requests. | ||
23 | * @author Andrey Uzunov | 27 | * @author Andrey Uzunov |
24 | */ | 28 | */ |
25 | 29 | ||
@@ -422,7 +426,12 @@ standard_request_handler(void *cls, | |||
422 | abort(); | 426 | abort(); |
423 | } | 427 | } |
424 | 428 | ||
425 | if(-1 == asprintf(&url,"%s%s%s","http://", http_host, path)) | 429 | if(0 == strcmp(http_host, "any")) |
430 | ret = asprintf(&url,"%s%s%s","http://", host, path); | ||
431 | else | ||
432 | ret = asprintf(&url,"%s%s%s","http://", http_host, path); | ||
433 | |||
434 | if(-1 == ret) | ||
426 | { | 435 | { |
427 | PRINT_INFO("No memory"); | 436 | PRINT_INFO("No memory"); |
428 | abort(); | 437 | abort(); |
@@ -489,7 +498,10 @@ main (int argc, char *const *argv) | |||
489 | 498 | ||
490 | if(argc != 6) | 499 | if(argc != 6) |
491 | { | 500 | { |
492 | printf("Usage: %s cert-file key-file host port http/1.0(yes/no)\n", argv[0]); | 501 | printf("Usage: %s cert-file key-file host port http/1.0(yes/no)\n\ |
502 | \n\ | ||
503 | Example for forward proxy (':host' header is used to know which HTTP server to connect):\n\ | ||
504 | %s cert.pem key.pem any 8080 no\n", argv[0], argv[0]); | ||
493 | return 1; | 505 | return 1; |
494 | } | 506 | } |
495 | 507 | ||