Author: matt
Date: 2012-06-15 13:52:12 -0700 (Fri, 15 Jun 2012)
New Revision: 9614
Log:
Added required libraries to VisualC environment.
Modified:
branches/branch-3.0/fltk.flw
branches/branch-3.0/ide/VisualC2008/connect.vcproj
branches/branch-3.0/ide/VisualC2010/connect.vcxproj
branches/branch-3.0/ide/VisualC6/connect.dsp
branches/branch-3.0/include/fltk3connect/HTTPClient.h
branches/branch-3.0/src/fltk3connect/HTTPClient.cxx
branches/branch-3.0/test/connect.cxx
Modified: branches/branch-3.0/fltk.flw
===================================================================
--- branches/branch-3.0/fltk.flw 2012-06-15 20:20:53 UTC (rev 9613)
+++ branches/branch-3.0/fltk.flw 2012-06-15 20:52:12 UTC (rev 9614)
@@ -4737,7 +4737,7 @@
uuid_Xcode4_FileRef {6653881E-1818-4C58-8184-FA6CB3475553}
filename_and_path {src/fltk3connect/FTPClient.cxx}
}
- file_ref {HTTPClient.cxx} {selected
+ file_ref {HTTPClient.cxx} {
uuid_Xcode4_BuildFileInSources {BB62323B-12F0-45A1-9A39-4499B2B54FD1}
uuid_Xcode4_FileRef {ADEDA03B-5D8F-47B2-B632-726B4498CFE4}
filename_and_path {src/fltk3connect/HTTPClient.cxx}
@@ -5621,7 +5621,7 @@
uuid_Xcode4_TargetDependency {11A4B5BE-B3AE-4FCD-B12C-FFB71C71FC4A}
}
}
- app_target connect {
+ app_target connect {open
uuid_Xcode4_FluidBuildRule {D1485AD4-24D6-4B10-ADDB-4C3478DE1E61}
uuid_Xcode4_CopyFilesBuildPhase {A2946547-FB07-40FA-A666-2CF278BA62AD}
uuid_Xcode4_ProductFileReference {2D59EFBA-4D3C-46E0-9427-7EC9F44B78D0}
@@ -5655,6 +5655,15 @@
uuid_Xcode4_ContainerItemProxy {280A81DE-05D7-4633-93A2-1C51596432A5}
uuid_Xcode4_TargetDependency {691D7169-3A68-40F4-895C-D8B0975D0C0E}
}
+ file_ref {ws2_32.lib} {selected
+ uuid_Xcode4_BuildFile {0124A007-B34A-4DE1-88FC-C30114BDB55B}
+ uuid_Xcode4_FileRef {C6A5409C-2471-45E7-B4BC-9D8776188EF4}
+ uuid_Xcode4_BuildFileInFrameworks
{EB58990F-7CE7-4F05-8B69-1B0E1213F98A}
+ build_env 28
+ list_env 28
+ filename_and_path {ws2_32.lib}
+ location 3
+ }
}
app_target cube {
uuid_Xcode4_FluidBuildRule {C4ADBFB6-1C2C-4F53-8D6C-25380F160B1E}
@@ -6291,7 +6300,7 @@
valuetype 2
}
}
- app_target glpuzzle {
+ app_target glpuzzle {open
uuid_Xcode4_FluidBuildRule {FC3DFF75-3E15-4CD7-868B-B6A8986E62FC}
uuid_Xcode4_CopyFilesBuildPhase {E01E4F29-B368-4661-BB01-5B0A57A4D7A7}
uuid_Xcode4_ProductFileReference {C9C8F484-77FD-4745-96D4-BC79311A3065}
Modified: branches/branch-3.0/ide/VisualC2008/connect.vcproj
===================================================================
--- branches/branch-3.0/ide/VisualC2008/connect.vcproj 2012-06-15 20:20:53 UTC
(rev 9613)
+++ branches/branch-3.0/ide/VisualC2008/connect.vcproj 2012-06-15 20:52:12 UTC
(rev 9614)
@@ -70,7 +70,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="fltk3d.lib
fltk3connectd.lib comctl32.lib"
+ AdditionalDependencies="fltk3d.lib
fltk3connectd.lib ws2_32.lib comctl32.lib"
OutputFile="..\..\test\connectd.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
@@ -161,7 +161,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="fltk3.lib
fltk3connect.lib comctl32.lib"
+ AdditionalDependencies="fltk3.lib
fltk3connect.lib ws2_32.lib comctl32.lib"
OutputFile="..\..\test\connect.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
Modified: branches/branch-3.0/ide/VisualC2010/connect.vcxproj
===================================================================
--- branches/branch-3.0/ide/VisualC2010/connect.vcxproj 2012-06-15 20:20:53 UTC
(rev 9613)
+++ branches/branch-3.0/ide/VisualC2010/connect.vcxproj 2012-06-15 20:52:12 UTC
(rev 9614)
@@ -70,7 +70,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
-
<AdditionalDependencies>fltk3d.lib;fltk3connectd.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+
<AdditionalDependencies>fltk3d.lib;fltk3connectd.lib;ws2_32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\test\connectd.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -114,7 +114,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
-
<AdditionalDependencies>fltk3.lib;fltk3connect.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+
<AdditionalDependencies>fltk3.lib;fltk3connect.lib;ws2_32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\test\connect.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
Modified: branches/branch-3.0/ide/VisualC6/connect.dsp
===================================================================
--- branches/branch-3.0/ide/VisualC6/connect.dsp 2012-06-15 20:20:53 UTC
(rev 9613)
+++ branches/branch-3.0/ide/VisualC6/connect.dsp 2012-06-15 20:52:12 UTC
(rev 9614)
@@ -53,7 +53,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /subsystem:windows /machine:I386
-# ADD LINK32 fltk3.lib fltk3connect.lib comctl32.lib kernel32.lib user32.lib
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386
/nodefaultlib:"libcd" /out:"../../test/connect.exe" /pdbtype:sept
/libpath:"..\..\lib"
+# ADD LINK32 fltk3.lib fltk3connect.lib ws2_32.lib comctl32.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386
/nodefaultlib:"libcd" /out:"../../test/connect.exe" /pdbtype:sept
/libpath:"..\..\lib"
# SUBTRACT LINK32 /pdb:none /incremental:yes
!ELSEIF "$(CFG)" == "connect - Win32 Debug"
@@ -80,7 +80,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 fltk3d.lib fltk3connectd.lib comctl32.lib kernel32.lib user32.lib
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386
/nodefaultlib:"libcd" /out:"../../test/connectd.exe" /pdbtype:sept
/libpath:"..\..\lib"
+# ADD LINK32 fltk3d.lib fltk3connectd.lib ws2_32.lib comctl32.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386
/nodefaultlib:"libcd" /out:"../../test/connectd.exe" /pdbtype:sept
/libpath:"..\..\lib"
# SUBTRACT LINK32 /pdb:none /incremental:no
!ENDIF
Modified: branches/branch-3.0/include/fltk3connect/HTTPClient.h
===================================================================
--- branches/branch-3.0/include/fltk3connect/HTTPClient.h 2012-06-15
20:20:53 UTC (rev 9613)
+++ branches/branch-3.0/include/fltk3connect/HTTPClient.h 2012-06-15
20:52:12 UTC (rev 9614)
@@ -36,26 +36,29 @@
#include <string.h>
namespace fltk3 {
+
+ /**
+ This class implements an HTTP communication client.
+
+ It can be used to manage network connections to HTTP servers. This is great
+ for fetching web pages and other resources from the world wide web.
+
+ HTTP is a state-less protocol. Generally, every transfer implies a new
+ connection to a server, a request, a reply by the server, and a disconnect.
+ There are options in the protocoll to keep a connection for multiple
+ transfers, but these are not in the scope of this class.
+
+ It is possible to create multiple HTTPClient objects that access the same
+ server simultaneously, which may or may not accelerate communications. Some
+ leterature recommends four to six clients working in parallel.
+
+ This class implements a minimal subset of the HTTP/1.1 standard.
+
+ Implemented: GET
+
+ Not Implemented: OPTIONS, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-/**
- This class implements an HTTP client widget.
- It can be used to manage network connections to HTTP servers. This is great
- for fetching web pages and other resources from the world wide web.
-
- port 80 (or 8080, etc)
-
- request (header, body)
- "GET /index.html HTTP/1.1\r\nHost: www.example.net\r\n\r\n"
-
- response (header, body)
- "HTTP/1.1 200 OK\r\n"
- "Server: Apache/1.3.29 (Unix) PHP/4.3.4\r\n"
- "Content-Length: 1024\r\n"
- "Content-Language: en\r\n"
- "Connection: close\r\n"
- "Content-Type: text/html\r\n"
- "\r\n" - binary data follows
- */
+ */
class HTTPClient : public TCPSocket
{
@@ -63,13 +66,60 @@
char *pHost;
+ int connect(const char *host);
+
public:
+ /**
+ Create a widget that communicates with a server using the HTTP protocol.
+
+ This widget manages an HTTP network connection, displaying a graphic
+ representation of the connection state. If no visual feedback is
+ required, this widget may be hidden or not be put into the widget
+ hierarchy at all.
+ */
HTTPClient(int x, int y, int w, int h, const char *label=0L);
+
+ /**
+ Return resources.
+ */
~HTTPClient();
- int connect(const char *host);
- int GET(const char *filename);
+ /**
+ Get a file from an HTTP server.
+
+ This method connects to an HTTP server and requests a file by name and
+ waits until the file is downloaded.
+
+ \param server name of the HTTP server. An optional port number can be
+ appended using the ':' notation.
+ \param filename the path and name of the file we want to download. A '/'
+ is prepended to the path if needed.
+ \param[out] data the class will allocate some memory to hold the
+ downloaded data; use free() to release memory. The allocated block
+ receives a trailing uncounted 'NUL' for your convinience
+ \param[out] size the size of the data block in bytes
+ \return 1 for a connection error, or the HTTP error code
+ (404 = not found, etc.)
+ */
+ int GET(const char *server, const char *filename, void *&data, int &size);
+
+ /**
+ Get a file from an HTTP server asynchronously.
+
+ This method connects to an HTTP server and requests a file by name. The
+ downloaded file will trigger an on_chunk_receive, on_file_receive,
+ on_timeout, or the corresponding callbacks.
+
+ \param server name of the HTTP server. An optional port number can be
+ appended using the ':' notation.
+ \param filename the path and name of the file we want to download. A '/'
+ is prepended to the path if needed.
+ \return 1 for a connection error, or 0
+ (404 = not found, etc.)
+ */
+ int GET(const char *server, const char *filename);
+
};
}
Modified: branches/branch-3.0/src/fltk3connect/HTTPClient.cxx
===================================================================
--- branches/branch-3.0/src/fltk3connect/HTTPClient.cxx 2012-06-15 20:20:53 UTC
(rev 9613)
+++ branches/branch-3.0/src/fltk3connect/HTTPClient.cxx 2012-06-15 20:52:12 UTC
(rev 9614)
@@ -32,6 +32,23 @@
#include <stdarg.h>
#include <string.h>
+/*
+ Sample data exchange:
+
+ port 80 (or 8080, etc)
+
+ request (header, body)
+ "GET /index.html HTTP/1.1\r\nHost: www.example.net\r\n\r\n"
+
+ response (header, body)
+ "HTTP/1.1 200 OK\r\n"
+ "Server: Apache/1.3.29 (Unix) PHP/4.3.4\r\n"
+ "Content-Length: 1024\r\n"
+ "Content-Language: en\r\n"
+ "Connection: close\r\n"
+ "Content-Type: text/html\r\n"
+ "\r\n" - binary data follows
+*/
fltk3::HTTPClient::HTTPClient(int x, int y, int w, int h, const char *l)
: fltk3::TCPSocket(x, y, w, h, l),
@@ -67,7 +84,7 @@
}
-int fltk3::HTTPClient::GET(const char *filename)
+int fltk3::HTTPClient::GET(const char *server, const char *filename, void
*&data, int &size)
{
int ret = -1;
#if 0
@@ -108,7 +125,17 @@
}
+int fltk3::HTTPClient::GET(const char *server, const char *filename)
+{
+ int ret = -1;
+#if 0
+ // empty
+#endif
+ return ret;
+}
+
+
//
// End of "$Id$".
//
Modified: branches/branch-3.0/test/connect.cxx
===================================================================
--- branches/branch-3.0/test/connect.cxx 2012-06-15 20:20:53 UTC (rev
9613)
+++ branches/branch-3.0/test/connect.cxx 2012-06-15 20:52:12 UTC (rev
9614)
@@ -50,8 +50,14 @@
#endif
#if 1
fltk3::HTTPClient *http = (fltk3::HTTPClient*)d;
- http->connect("www.fltk.org");
- http->GET("index.php");
+ void *data = 0;
+ int size;
+ int ret = http->GET("www.fltk.org", "index.php", data, size);
+ if (data) {
+ puts((char*)data);
+ free(data);
+ }
+ printf("Err: %d\n", ret);
#endif
}
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit