Gwan C#,如何获取HTTP标头? [英] Gwan C#, how to get HTTP headers?

查看:99
本文介绍了Gwan C#,如何获取HTTP标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要它来重写url,以了解我正在处理哪个友好的url.用于User-Agent和其他功能.

I need it for rewriting url, to know which friendly url I am processing. For User-Agent and other stuff.

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());

未处理的异常:System.MissingMethodException:找不到 要求的方法.在(包装器管理到本地)Gwan:getEnv (字符串,整数)

Unhandled Exception: System.MissingMethodException: Cannot find the requested method. at (wrapper managed-to-native) Gwan:getEnv (string,int)

我在做什么错了?

我想在您的一端,您需要输入以下内容:

I guess on your end you need to put something like:

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

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

Dll in /cs folder where gwan_api also is not Loaded

推荐答案

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

Like for Java, G-WAN created some wrappers for the G-WAN C API. In both cases (Java and C#), these wrappers can be found under the gwan/libraries/cs directory.

当前,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库.

But you can freely extend this file by adding more wrappers, either for the G-WAN C API, or for third-party C libraries loaded by your G-WAN scripts.

希望这会有所帮助.

编辑

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

You must implement the C# wrappers for any new G-WAN API (or external function) you want to support from your C# scripts.

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

The include file listed above is a mere list (not implementation).

有关更多详细信息,请参阅Mono文档-如果您想赞助所需的功能,请在G-WAN上给我们留言.

Please refer to the Mono documentation for more details - or drop us a line at G-WAN if you want to sponsor the features you need.

这篇关于Gwan C#,如何获取HTTP标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆