| 95 | } |
| 96 | |
| 97 | static void GetHeader(Local<String> property, const PropertyCallbackInfo<Value> &args) { |
| 98 | String::Utf8Value name(property); |
| 99 | |
| 100 | MNS::SocketData *data = static_cast<MNS::SocketData *>(args.Holder()->GetPrototype()->ToObject()->GetAlignedPointerFromInternalField(0)); |
| 101 | |
| 102 | if(data) { |
| 103 | std::map<std::string, std::string>::const_iterator it = data->request->headers.find(std::string(*name, name.length())); |
| 104 | |
| 105 | if (it != data->request->headers.end()) { |
| 106 | args.GetReturnValue().Set(String::NewFromOneByte(args.GetIsolate(), (uint8_t *) it->second.c_str(), String::kNormalString, it->second.length())); |
| 107 | } else { |
| 108 | args.GetReturnValue().Set(Undefined(args.GetIsolate())); |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | static void GetSocket(Local<String> property, const PropertyCallbackInfo<Value> &args) { |
| 114 | // TODO |