diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2022-01-16 10:49:42 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2022-01-16 10:49:42 -0800 |
commit | bb6a73f97f87ce06dcc9f3b2b129b7fde657b22c (patch) | |
tree | c989f44eadae30aa62e8393cb7465549fd2ca7c3 /src/main/java/org | |
parent | 071f038906ebcd29a42803e32ffe65efde57dbb6 (diff) | |
download | trackermap-server-bb6a73f97f87ce06dcc9f3b2b129b7fde657b22c.tar.gz trackermap-server-bb6a73f97f87ce06dcc9f3b2b129b7fde657b22c.tar.bz2 trackermap-server-bb6a73f97f87ce06dcc9f3b2b129b7fde657b22c.zip |
Add request headers
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/OrbcommProtocolPoller.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/OrbcommProtocolPoller.java b/src/main/java/org/traccar/protocol/OrbcommProtocolPoller.java index 87fa039e1..9465f63a7 100644 --- a/src/main/java/org/traccar/protocol/OrbcommProtocolPoller.java +++ b/src/main/java/org/traccar/protocol/OrbcommProtocolPoller.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.handler.codec.http.DefaultFullHttpRequest; +import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpMethod; import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpVersion; @@ -37,6 +38,7 @@ public class OrbcommProtocolPoller extends BaseProtocolPoller { private final String accessId; private final String password; + private final String host; private Date startTime = new Date(); @@ -48,6 +50,7 @@ public class OrbcommProtocolPoller extends BaseProtocolPoller { super(protocol); accessId = Context.getConfig().getString(Keys.ORBCOMM_ACCESS_ID); password = Context.getConfig().getString(Keys.ORBCOMM_PASSWORD); + host = Context.getConfig().getString(Keys.PROTOCOL_ADDRESS.withPrefix(protocol.getName())); } @Override @@ -63,6 +66,8 @@ public class OrbcommProtocolPoller extends BaseProtocolPoller { HttpRequest request = new DefaultFullHttpRequest( HttpVersion.HTTP_1_1, HttpMethod.POST, encoder.toString(), Unpooled.buffer()); + request.headers().add(HttpHeaderNames.HOST, host); + request.headers().add(HttpHeaderNames.CONTENT_LENGTH, 0); channel.writeAndFlush(request); } |