Skip to content

Commit b1567be

Browse files
committed
commit
1 parent 8aa4ffa commit b1567be

File tree

8 files changed

+375
-0
lines changed

8 files changed

+375
-0
lines changed

AUTHORS

Whitespace-only changes.

ChangeLog

Whitespace-only changes.

Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SUBDIRS = lib
2+
ACLOCAL_AMFLAGS = -I m4
3+
4+
-include $(top_srcdir)/git.mk

NEWS

Whitespace-only changes.

README

Whitespace-only changes.

configure.ac

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# -*- Autoconf -*-
2+
# Process this file with autoconf to produce a configure script.
3+
4+
AC_PREREQ([2.57])
5+
6+
m4_define([xllx_major_version], [13])
7+
m4_define([xllx_minor_version], [8])
8+
m4_define([xllx_micro_version], [2])
9+
m4_define([xllx_interface_age], [1])
10+
m4_define([xllx_binary_age], [m4_eval(100 * xllx_minor_version + xllx_micro_version)])
11+
m4_define([xllx_version], xllx_major_version.xllx_minor_version.xllx_micro_version)
12+
m4_define([xllx_lt_release], [xllx_major_version.xllx_minor_version])
13+
m4_define([xllx_lt_current], [m4_eval(100 * xllx_minor_version + xllx_micro_version - xllx_interface_age)])
14+
m4_define([xllx_lt_revision], [xllx_interface_age])
15+
m4_define([xllx_lt_age], [m4_eval(xllx_binary_age - xllx_interface_age)])
16+
17+
AC_INIT([xllx], [xllx_version], [http://bugs.htpcos.org])
18+
AC_CONFIG_SRCDIR([lib/http.c])
19+
AC_CONFIG_HEADERS([config.h])
20+
AC_CONFIG_MACRO_DIR([m4])
21+
22+
AC_DEFINE(XLLX_MAJOR_VERSION, xllx_major_version, [Mimgr major version])
23+
AC_SUBST(XLLX_MAJOR_VERSION, xllx_major_version)
24+
AC_DEFINE(XLLX_MINOR_VERSION, xllx_minor_version, [Mimgr minor version])
25+
AC_SUBST(XLLX_MINOR_VERSION, xllx_minor_version)
26+
AC_DEFINE(XLLX_MICRO_VERSION, xllx_micro_version, [Mimgr micro version])
27+
AC_SUBST(XLLX_MICRO_VERSION, xllx_micro_version)
28+
AC_DEFINE(XLLX_API_VERSION, xllx_interface_age, [Mimgr api version])
29+
AC_DEFINE(API_VERSION, ["xllx_interface_age"], [Mimgr api version])
30+
AC_SUBST(API_VERSION, ["xllx_interface_age"])
31+
32+
AM_INIT_AUTOMAKE([1.11 tar-ustar dist-xz no-dist-gzip -Wno-portability])
33+
AM_MAINTAINER_MODE([enable])
34+
35+
AM_SILENT_RULES([yes])
36+
37+
# libtool versioning
38+
LT_RELEASE=xllx_lt_release
39+
LT_CURRENT=xllx_lt_current
40+
LT_REVISION=xllx_lt_revision
41+
LT_AGE=xllx_lt_age
42+
LT_CURRENT_MINUS_AGE=xllx_lt_current_minus_age
43+
AC_SUBST(LT_RELEASE)
44+
AC_SUBST(LT_CURRENT)
45+
AC_SUBST(LT_REVISION)
46+
AC_SUBST(LT_AGE)
47+
AC_SUBST(LT_CURRENT_MINUS_AGE)
48+
49+
# Checks for programs.
50+
AC_PROG_CC
51+
AM_PROG_LIBTOOL
52+
PKG_PROG_PKG_CONFIG
53+
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4")
54+
55+
# Initialize libtool
56+
LT_PREREQ([2.2.6])
57+
LT_INIT(disable-static)
58+
59+
# Checks for library functions.
60+
AC_CHECK_FUNCS([strdup])
61+
62+
# Checks for header files.
63+
AC_HEADER_STDC
64+
AC_FUNC_ALLOCA
65+
AC_CHECK_HEADERS([fcntl.h memory.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
66+
67+
# Checks for typedefs, structures, and compiler characteristics.
68+
AC_TYPE_INT64_T
69+
AC_TYPE_SIZE_T
70+
AC_TYPE_UINT64_T
71+
72+
# Checks for library functions.
73+
AC_FUNC_MALLOC
74+
AC_FUNC_MKTIME
75+
AC_FUNC_REALLOC
76+
AC_CHECK_FUNCS([gethostbyname gettimeofday memmove memset socket strcasecmp strchr strdup strerror strndup strstr strtol])
77+
78+
dnl *********************
79+
dnl *** debug options ***
80+
dnl *********************
81+
enable_debug="yes"
82+
AC_ARG_ENABLE([debug],
83+
AS_HELP_STRING([--disable-debug],[Disable debug(default: enabled)]),
84+
[enable_debug=$enableval],
85+
[enable_debug=yes])
86+
87+
AM_CONDITIONAL(ENABLE_DEBUG, test x"$enable_debug" = "xyes")
88+
89+
dnl *********************
90+
dnl *** JSON checks ***
91+
dnl *********************
92+
JSON_REQUIRED_VERSION=0.9
93+
PKG_CHECK_MODULES(JSON, json >= $JSON_REQUIRED_VERSION)
94+
AC_SUBST(JSON_CFLAGS)
95+
AC_SUBST(JSON_LIBS)
96+
97+
dnl *************************
98+
dnl *** libev checks ***
99+
dnl *************************
100+
AC_CHECK_LIB(ev, ev_run, [AC_CHECK_HEADER(ev.h, found_ev=yes)], found_ev=no)
101+
if test "x$found_ev" = "xno" ; then
102+
AC_MSG_ERROR([*** Working libev not found ***])
103+
fi
104+
EV_LIBS='-lev'
105+
AC_SUBST(EV_LIBS)
106+
107+
# checks for zlib
108+
PKG_CHECK_MODULES(ZLIB, [zlib >= 1.2], [AC_DEFINE(USE_ZLIB, 1, [Use ZLIB])])
109+
AC_SUBST(ZLIB_CFLAGS)
110+
AC_SUBST(ZLIB_LIBS)
111+
112+
113+
AC_CONFIG_FILES([
114+
Makefile
115+
lib/Makefile
116+
lib/libghttp/Makefile
117+
])
118+
119+
AC_OUTPUT

git.mk

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# git.mk
2+
#
3+
# Copyright 2009, Red Hat, Inc.
4+
# Written by Behdad Esfahbod
5+
#
6+
# Copying and distribution of this file, with or without modification,
7+
# are permitted in any medium without royalty provided the copyright
8+
# notice and this notice are preserved.
9+
#
10+
# The canonical source for this file is pango/git.mk, or whereever the
11+
# header of pango/git.mk suggests in the future.
12+
#
13+
# To use in your project, import this file in your git repo's toplevel,
14+
# then do "make -f git.mk". This modifies all Makefile.am files in
15+
# your project to include git.mk.
16+
#
17+
# This enables automatic .gitignore generation. If you need to ignore
18+
# more files, add them to the GITIGNOREFILES variable in your Makefile.am.
19+
# But think twice before doing that. If a file has to be in .gitignore,
20+
# chances are very high that it's a generated file and should be in one
21+
# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
22+
#
23+
# The only case that you need to manually add a file to GITIGNOREFILES is
24+
# when remove files in one of mostlyclean-local, clean-local, distclean-local,
25+
# or maintainer-clean-local.
26+
#
27+
# Note that for files like editor backup, etc, there are better places to
28+
# ignore them. See "man gitignore".
29+
#
30+
# If "make maintainer-clean" removes the files but they are not recognized
31+
# by this script (that is, if "git status" shows untracked files still), send
32+
# me the output of "git status" as well as your Makefile.am and Makefile for
33+
# the directories involved.
34+
#
35+
# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
36+
# pango/Makefile.am.
37+
#
38+
# Don't EXTRA_DIST this file. It is supposed to only live in git clones,
39+
# not tarballs. It serves no useful purpose in tarballs and clutters the
40+
# build dir.
41+
#
42+
# This file knows how to handle autoconf, automake, libtool, gtk-doc,
43+
# gnome-doc-utils, mallard, intltool, gsettings.
44+
#
45+
#
46+
# KNOWN ISSUES:
47+
#
48+
# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
49+
# submodule doesn't find us. If you have configure.{in,ac} files in
50+
# subdirs, add a proxy git.mk file in those dirs that simply does:
51+
# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste.
52+
# And add those files to git. See vte/gnome-pty-helper/git.mk for
53+
# example.
54+
#
55+
# ChangeLog
56+
#
57+
# - 2010-12-06 Add support for Mallard docs
58+
# - 2010-12-06 Start this change log
59+
60+
git-all: git-mk-install
61+
62+
git-mk-install:
63+
@echo Installing git makefile
64+
@any_failed=; find $(top_srcdir) -name Makefile.am | while read x; do \
65+
if grep 'include .*/git.mk' $$x >/dev/null; then \
66+
echo $$x already includes git.mk; \
67+
else \
68+
failed=; \
69+
echo "Updating $$x"; \
70+
{ cat $$x; \
71+
echo ''; \
72+
echo '-include $$(top_srcdir)/git.mk'; \
73+
} > $$x.tmp || failed=1; \
74+
if test x$$failed = x; then \
75+
mv $$x.tmp $$x || failed=1; \
76+
fi; \
77+
if test x$$failed = x; then : else \
78+
echo Failed updating $$x; >&2 \
79+
any_failed=1; \
80+
fi; \
81+
fi; done; test -z "$$any_failed"
82+
83+
.PHONY: git-all git-mk-install
84+
85+
86+
### .gitignore generation
87+
88+
$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
89+
$(AM_V_GEN) \
90+
{ \
91+
if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
92+
for x in \
93+
$(DOC_MODULE)-decl-list.txt \
94+
$(DOC_MODULE)-decl.txt \
95+
tmpl/$(DOC_MODULE)-unused.sgml \
96+
"tmpl/*.bak" \
97+
xml html \
98+
; do echo /$$x; done; \
99+
fi; \
100+
if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
101+
for x in \
102+
$(_DOC_C_DOCS) \
103+
$(_DOC_LC_DOCS) \
104+
$(_DOC_OMF_ALL) \
105+
$(_DOC_DSK_ALL) \
106+
$(_DOC_HTML_ALL) \
107+
$(_DOC_MOFILES) \
108+
$(_DOC_POFILES) \
109+
$(DOC_H_FILE) \
110+
"*/.xml2po.mo" \
111+
"*/*.omf.out" \
112+
; do echo /$$x; done; \
113+
fi; \
114+
if test "x$(gsettings_SCHEMAS)" = x; then :; else \
115+
for x in \
116+
$(gsettings_SCHEMAS:.xml=.valid) \
117+
$(gsettings__enum_file) \
118+
; do echo /$$x; done; \
119+
fi; \
120+
if test -f $(srcdir)/po/Makefile.in.in; then \
121+
for x in \
122+
po/Makefile.in.in \
123+
po/Makefile.in \
124+
po/Makefile \
125+
po/POTFILES \
126+
po/stamp-it \
127+
po/.intltool-merge-cache \
128+
"po/*.gmo" \
129+
"po/*.mo" \
130+
po/$(GETTEXT_PACKAGE).pot \
131+
intltool-extract.in \
132+
intltool-merge.in \
133+
intltool-update.in \
134+
; do echo /$$x; done; \
135+
fi; \
136+
if test -f $(srcdir)/configure; then \
137+
for x in \
138+
autom4te.cache \
139+
configure \
140+
config.h \
141+
stamp-h1 \
142+
libtool \
143+
config.lt \
144+
; do echo /$$x; done; \
145+
fi; \
146+
for x in \
147+
.gitignore \
148+
$(GITIGNOREFILES) \
149+
$(CLEANFILES) \
150+
$(PROGRAMS) \
151+
$(check_PROGRAMS) \
152+
$(EXTRA_PROGRAMS) \
153+
$(LTLIBRARIES) \
154+
so_locations \
155+
.libs _libs \
156+
$(MOSTLYCLEANFILES) \
157+
"*.$(OBJEXT)" \
158+
"*.lo" \
159+
$(DISTCLEANFILES) \
160+
$(am__CONFIG_DISTCLEAN_FILES) \
161+
$(CONFIG_CLEAN_FILES) \
162+
TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
163+
"*.tab.c" \
164+
$(MAINTAINERCLEANFILES) \
165+
$(BUILT_SOURCES) \
166+
$(DEPDIR) \
167+
Makefile \
168+
Makefile.in \
169+
"*.orig" \
170+
"*.rej" \
171+
"*.bak" \
172+
"*~" \
173+
".*.sw[nop]" \
174+
".dirstamp" \
175+
; do echo /$$x; done; \
176+
} | \
177+
sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
178+
sed 's@/[.]/@/@g' | \
179+
LC_ALL=C sort | uniq > $@.tmp && \
180+
mv $@.tmp $@;
181+
182+
all: $(srcdir)/.gitignore gitignore-recurse-maybe
183+
gitignore-recurse-maybe:
184+
@if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
185+
$(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \
186+
fi;
187+
gitignore-recurse:
188+
@for subdir in $(DIST_SUBDIRS); do \
189+
case " $(SUBDIRS) " in \
190+
*" $$subdir "*) :;; \
191+
*) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir");; \
192+
esac; \
193+
done
194+
gitignore: $(srcdir)/.gitignore gitignore-recurse
195+
196+
maintainer-clean: gitignore-clean
197+
gitignore-clean:
198+
-rm -f $(srcdir)/.gitignore
199+
200+
.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe

lib/main.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* vi: set sw=4 ts=4 wrap ai: */
2+
/*
3+
* main.c: This file is part of ____
4+
*
5+
* Copyright (C) 2013 yetist <[email protected]>
6+
*
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation; either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License along
19+
* with this program; if not, write to the Free Software Foundation, Inc.,
20+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21+
* */
22+
#include <stdio.h>
23+
24+
#include "http.h"
25+
#include "smemory.h"
26+
#include "logger.h"
27+
28+
int main(int argc, char** argv)
29+
{
30+
if (argc != 2)
31+
return -1;
32+
33+
char *uri = argv[1];
34+
XLHttpRequest *req = xl_http_request_new(uri);
35+
if (req) {
36+
int ret = 0;
37+
ret = xl_http_request_open(req, 0, NULL);
38+
if (ret == 0) {
39+
xl_log(LOG_NOTICE, "Http response code: %d\n", xl_http_request_get_status(req));
40+
xl_log(LOG_NOTICE, "Http response buf: %s\n", xl_http_request_get_response(req));
41+
xl_log(LOG_NOTICE, "Http [cookie]BDSVRTM: %s\n", xl_http_request_get_cookie(req, "BDSVRTM"));
42+
xl_log(LOG_NOTICE, "Http [cookie]H_PS_PSSID: %s\n", xl_http_request_get_cookie(req, "H_PS_PSSID"));
43+
xl_log(LOG_NOTICE, "Http [header]BDQID: %s\n", xl_http_request_get_header(req, "BDQID"));
44+
if (xl_http_request_get_status(req) == 302)
45+
{
46+
xl_log(LOG_NOTICE, "Http [header]Location: %s\n", xl_http_request_get_header(req, "Location"));
47+
}
48+
}
49+
xl_http_request_free(req);
50+
}
51+
return 0;
52+
}

0 commit comments

Comments
 (0)