[aprssig] APRS POST HTTP

Heikki Hannikainen hessu at hes.iki.fi
Mon Mar 9 18:12:50 EDT 2020


Hi,

You'l need to have an actual LF character there between the login command 
and the packet. Not a string like "%LF%", that is not a linefeed 
character, that's a string of four letters % L F and %.

Try the $'' format for the parameter which gives you backslash escape 
sequences in a command line parameter in the shell, and the \n linefeed 
escape:

   $'user N0CALL pass 1234\nSRCCALL>DSTCALL'

On Mon, 9 Mar 2020, Rafał Antas wrote:

> Hi!
> I have changed port to 8080. I have managed to get what I want using UDP. There is ESP Easy limitation in
> command SendToUDP which is using only IP not DNS name to connect to UDP server. My aim is to use
> rotate.aprs2.net Now I am trying to setup everything using HTTP Controller. I have managed to put right HTTP
> headers and on my option correct http body (user SQ4LOL pass 23475 vers EasyESPWX
> 1.0%CR%%LF%SQ4LOL>APRS,TCPIP*:=5244.43N/02333.50E-430.400MHz /A=000538 Pi-Star Rafal QTH:Hajnowka
> 73!%CR%%LF%) but it does not work. Curl command is throwing 400 No newline (LF) found in data
> 
> curl -v -d "user SQ4LOL pass 23475 vers EasyESPWX
> 1.0%CR%%LF%SQ4LOL>APRS,TCPIP*:=5244.43N/02333.50E-430.400MHz /A=000538 Pi-Star Rafal QTH:Hajnowka
> 73!%CR%%LF%" poland.aprs2.net:8080 -H "Content-Type: application/octet-stream"
> * Rebuilt URL to: 192.168.237.197:8080/
> *   Trying 192.168.237.197...
> * TCP_NODELAY set
> * Connected to 192.168.237.197 (192.168.237.197) port 8080 (#0)
> > POST / HTTP/1.1
> > Host: 192.168.237.197:8080
> > User-Agent: curl/7.55.1
> > Accept: */*
> > Content-Type: application/octet-stream
> > Content-Length: 147
> >
> * upload completely sent off: 147 out of 147 bytes
> < HTTP/1.1 400 No newline (LF) found in data
> < Content-Type: text/html
> < Connection: close
> < Date: Mon, 09 Mar 2020 22:00:53 GMT
> < Content-Length: 130
> <
> 
> 
> 
> 
> 
> Pozdrawiam,
> Rafał Antas
> 
> 
> pon., 9 mar 2020 o 22:33 Heikki Hannikainen <hessu at hes.iki.fi> napisał(a):
>
>       Rafał,
>
>       The basic problem with your 'curl' approach is that you are using a HTTP
>       client (curl) to talk to an APRS-IS server, on port 14580. Port 14580 does
>       not talk the HTTP protocol, and it never has, even on javaprssrvr.
>
>       When you run that curl command, it'll send a number of HTTP request
>       headers, and only then it sends the 'user' command line as the POST body.
>       javaprssrvr 3.x apparently ignores all those invalid commands and then
>       accepts the 'user' login command. aprsc throws the client out a bit faster
>       after a few invalid commands (repeatedly failed login).
>
>       Try 'nc' (netcat) instead of 'curl' to make a plain TCP connection instead
>       of HTTP over TCP.
>
>       John Gorkos suggested that javaprssrvr might do a websocket connection,
>       but no, that's a recent javaprssrvr 4.x feature, the server in question
>       was an old 3.15 version, and the websocket thing still won't run on port
>       14580 on the 4.x versions (websocket happens over HTTP, not over the
>       APRS-IS port). And no, aprsc doesn't do the websocket thing.
>
>       Both aprsc and javaprssrvr do support a HTTP post of a packet on port
>       8080, as documented here: http://www.aprs-is.net/SendOnlyPorts.aspx - the
>       curl command should probably work there if a packet was also appended
>       after the "user" login command (with a CRLF in between). Not all servers
>       are configured with port 8080 support, but all servers on the
>       rotate.aprs2.net DNS rotate service should have it.
> 
>
>       On Thu, 5 Mar 2020, Rafał Antas wrote:
>
>       >
>       > Hi Guys,
>       >
>       >
>       > I am writing to you since you might help with my small problem. My friend (SQ2CET) and I
>       (SQ4LOL) developed
>       > small WX station using ESP8266 powered by ESPEASY software. Everything was fine WX date was
>       pushed to APRS.fi
>       > without any problems till yesterday. Poland APRS server (Poland.aprs2.net) was migrated from
>       java
>       > to aprsc and I think this is causing this problem for us. We are using POST http method to push
>       data to APRS.
>       > I am trying to compare Poland APRS server, running on aprsc to Czech running java. Everything
>       is ok when we
>       > are sending data to Czech server, but Poland server is not. I tried to compare it using curl
>       command.
>       >
>       > Poland:
>       >
>       > curl --verbose --data "user SQ4LOL pass 12345" poland.aprs2.net:14580
>       >
>       > * Rebuilt URL to: poland.aprs2.net:14580/
>       >
>       > *   Trying 46.21.223.230...
>       >
>       > * TCP_NODELAY set
>       >
>       > * Connected to poland.aprs2.net (46.21.223.230) port 14580 (#0)
>       >
>       > > POST / HTTP/1.1
>       >
>       > > Host: poland.aprs2.net:14580
>       >
>       > > User-Agent: curl/7.55.1
>       >
>       > > Accept: */*
>       >
>       > > Content-Length: 22
>       >
>       > > Content-Type: application/x-www-form-urlencoded
>       >
>       > > 
>       >
>       > * upload completely sent off: 22 out of 22 bytes
>       >
>       > # aprsc 2.1.5-g8af3cdc
>       >
>       > # Invalid login command
>       >
>       > # Invalid login command
>       >
>       > * Connection #0 to host poland.aprs2.net left intact
>       >
>       >  
>       >
>       > Czech:
>       >
>       >  
>       >
>       > curl --verbose --data "user SQ4LOL pass 12345" czech.aprs2.net:14580
>       >
>       > * Rebuilt URL to: czech.aprs2.net:14580/
>       >
>       > *   Trying 89.235.48.27...
>       >
>       > * TCP_NODELAY set
>       >
>       > * Connected to czech.aprs2.net (89.235.48.27) port 14580 (#0)
>       >
>       > > POST / HTTP/1.1
>       >
>       > > Host: czech.aprs2.net:14580
>       >
>       > > User-Agent: curl/7.55.1
>       >
>       > > Accept: */*
>       >
>       > > Content-Length: 22
>       >
>       > > Content-Type: application/x-www-form-urlencoded
>       >
>       > > 
>       >
>       > * upload completely sent off: 22 out of 22 bytes
>       >
>       > # javAPRSSrvr 3.15b08
>       >
>       >  
>       >
>       > Do you have any idea how we can solve this small problem?
>       >
>       > Pozdrawiam,
>       > Rafał Antas
>       >
>       >
>
>          - Hessu_______________________________________________
>       aprssig mailing list
>       aprssig at lists.tapr.org
>       http://lists.tapr.org/mailman/listinfo/aprssig_lists.tapr.org
> 
> 
>

   - Hessu


More information about the aprssig mailing list