Gwan C#,如何获取HTTP头?

我需要它来重写url,知道我正在处理哪个友好url。 对于User-Agent和其他东西。

编辑:

public class Gwan { [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static long getEnv(string arg, int name); } Gwan.xbufCat(Gwan.getReply(args[0]), Gwan.getEnv(args[0], 3).ToString()); 

未处理的exception:System.MissingMethodException:找不到请求的方法。 at(wrapper managed-to-native)Gwan:getEnv(string,int)

我究竟做错了什么?

我想你最后需要做的事情如下:

 mono_add_internal_call ("Gwan::getEnv", get_env); 

在/ cs文件夹中的dll,其中gwan_api也未加载

与Java一样,G-WAN为G-WAN C API创建了一些包装器。 在这两种情况下(Java和C#),可以在gwan/libraries/cs目录下找到这些包装器。

目前,C#包装器是:

 // gwan_api.cs: exported G-WAN API calls for .NET C# servlets using System; using System.Runtime.CompilerServices; public class Gwan { [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static long getReply(string env); [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static void xbufCat(long reply, string mono_reply); [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static long cycles64(); [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static long getNs (); [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static long getUs (); [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static long getMs (); [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static void logErr (long env, String msg); [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static void report (long reply, int html_format); } 

但是,您可以通过添加更多包装器来自由扩展此文件,无论是G-WAN C API还是G-WAN脚本加载的第三方C库。

希望这可以帮助。


编辑

您必须为要从C#脚本支持的任何新G-WAN API(或外部函数)实现C#包装器。

上面列出的包含文件仅仅是一个列表(不是实现)。

有关详细信息,请参阅Mono文档 – 如果您想赞助所需function,请在G-WAN上留言。

我想你必须在他们的网站上查看支持信息或试验输出标题的代码,尝试将它们输出到messagebox.show(headersvariable); 首先

http://gwan.com/developers#tab3

 REQUEST_LEN, // int REQUEST_LEN // strlen(REQUEST); with headers HTTP_HEADERS, // struct *http_t; // see struct http_t above HEAD_XBUF, // xbuf_t*HEAD_XBUF; // response HTTP headers(), if any